Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use winspool.drv #566

Open
fpauser opened this issue Sep 9, 2019 · 1 comment
Open

Unable to use winspool.drv #566

fpauser opened this issue Sep 9, 2019 · 1 comment

Comments

@fpauser
Copy link

fpauser commented Sep 9, 2019

This is what I tried. Problem ist, that ffi.Library only works with pathes that end in '.dll'.

const ffi = require('ffi');
const ref = require('ref');
const Struct = require('ref-struct');
const wchar_t = require('ref-wchar');

const int = ref.types.int;
const intPtr = ref.refType(int);

const winspoolDll = 'c:\\windows\\system32\\winspool.drv';
const winspoolLib = ffi.Library(winspoolDll, {
  'EnumPrintersW': [int, [int, ref.types.CString, int, printerInfoPtr, int, intPtr, intPtr]]
});

This gives me the follwing DEBUG output which shows, that ffi.Library adds the .dll extension when it gets called with a name/path that does not end in dll (e.g. winspool.drv).

 ref setting value on allocated buffer c:\windows\system32\winspool.drv.dll +0ms
  ref set(): (offset: 0) <Buffer@0x00000298EF888D10 00 00 00 00 00 00 00 00> c:\windows\system32\winspool.drv.dll +1ms
  ref writing pointer to buffer <Buffer@0x00000298EF888D10 00 00 00 00 00 00 00 00> 0 <Buffer@0x00000298F1705170 63 3a 5c 77 69 6e 64 6f 77 73 5c 73 79 73 74 65 6d 33 32 5c 77 69 6e 73 70 6f 6f 6c 2e 64 72 76 2e 64 6c 6c 00> +0ms
  ref writing pointer to buffer <Buffer@0x00000298F170CA90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00> 0 <Buffer@0x00000298EF888D10 70 51 70 f1 98 02 00 00> +1ms
  ref allocating Buffer for type with "size" 4 +0ms
  ref setting value on allocated buffer 0 +1ms
  ref set(): (offset: 0) <Buffer@0x00000298EF888E00 00 00 00 00> 0 +0ms
  ref writing pointer to buffer <Buffer@0x00000298F170CA90 10 8d 88 ef 98 02 00 00 00 00 00 00 00 00 00 00> 8 <Buffer@0x00000298EF888E00 00 00 00 00> +1ms
  ref dereferencing buffer <Buffer@0x00000298EF888DE0 00 00 00 00 00 00 00 00> +0ms
  ref get(): (offset: 0) <Buffer@0x00000298EF888DE0 00 00 00 00 00 00 00 00> +1ms
  ffi:DynamicLibrary dlerror() +0ms
@fpauser
Copy link
Author

fpauser commented Sep 9, 2019

Looks like #416 would be the cure for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant