I am using NetWkstaGetInfo in order to determine the domain name of the computer my application is running on. This works fine both as an executable run from a user profile and from a windows service immediately running the code upon launch.
However, NetWkstaGetInfo fails when I attempt to run it from the Startup routine of a Winlogon Notify dll. If I delay the execution it succeeds. However if it runs without some sort of pause, it fails.
Does anyone know why exactly this is failing without the pause? I imagine the network information obtained by the function might not be available. Is there anyway to detect when it is available in a non-busy manner (I prefer whenever possible not to sleep and loop)? Is there any other technique that might succeed when NetWkstaGetInfo fails? I have tried GetNetworkParams. It gives no indication of failure, however the domain name it acquires is just an empty string if I do not include a pause.
Thanks for any help you can give.