Mail Archives: cygwin/1997/10/14/10:06:03
Tim Newsham wrote:
>
> Hi,
>
> I found a reference to a function named "NetEnumerateTrustedDomains"
> and wanted to use it. I found it listed in the microsoft headers
> in <LMACCESS.H> as:
>
> NTSTATUS
> NetEnumerateTrustedDomains (
> IN LPWSTR ServerName OPTIONAL,
> OUT LPWSTR *DomainNames
> );
>
> so I made a test case using:
>
> #include <windows.h>
>
> DWORD STDCALL NetEnumerateTrustedDomains(LPWSTR, LPWSTR *);
> [... some code ...]
>
> but when I went to link it I got an unresolved error:
>
> C:\TEMP\cc0010491.o(.text+0x36):doms.c: undefined
> reference to `NetEnumerateTrustedDomains AT 8'
>
> so I checked through the libnetapi32.a and found it missing:
>
> % nm libnetapi32.a |grep NetEnum
> [nothing]
>
It is really not there. You will either have to build a new import library
for netapi32.dll. Look for netapi32.def in the CDK source tree (winsup/sysdef I believe)
and add a line
NetEnumerateTrustedDomains AT 8
without any @xx stuff. If the other function names in the netapi32.def file
have preceding underscores add one also the new line.
Build the import library by executing dlltool:
dlltool -k --dllname netapi32.dll --output-lib libnetapi32.a --def netapi32.def
If the functions names in netapi32.def have preceding underscores add
the '-U' option to the dlltool command line.
> If I look at the netapi32.dll in quikview, its in there:
>
> Export Table
> Ordinal Entry Point Name
> 0044 00010786 NetEnumerateTrustedDomains
>
> So the questions
>
> - why isnt this function in the generated .a?
It has probably been forgotten, perhaps because this function isn't documented
at least in the MSDN library.
> - how is it decided which functions are put into the generated .a's?
One has to write the import definition files manually.
> - can I call this function without building a new .a? or can
> I generate a minimal .a that will let me call this function?
I think it doesn't make much sense to create a new minimal import library
for just one function. Create a new libnetapi32.a library instead.
However, you can call this function also without creating a new import library
(error checking code omitted):
typedef DWORD STDCALL (*fntype)(LPWSTR, LPWSTR *);
void foo(LPWSTR servername, LPWSTR *domains)
{
HANDLE hNetApiDLL = LoadLibrary("netapi32.dll");
fntype fptr = (fntype)
GetProcAddress(hNetApiDLL, "NetEnumerateTrustedDomains");
(*fptr)(servername, domains);
}
> - how can I make a new libnetapi32.a that has this function referenced?
described above
>
> Tim N.
>
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request AT cygnus DOT com" with one line of text: "help".
--
Gunther Ebert
iXOS Anwendungs-Software GmbH
Angerstrasse 40-42
D-04177 Leipzig
Phone : +49 341 48503-0
Fax : +49 341 48503-99
E-mail: mailto:gunther DOT ebert AT ixos-leipzig DOT de
www : http://www.ixos-leipzig.de
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -