Index: dll/win32/ws2_32/src/nsprovid.c =================================================================== --- dll/win32/ws2_32/src/nsprovid.c (revision 74014) +++ dll/win32/ws2_32/src/nsprovid.c (working copy) @@ -10,6 +10,9 @@ #include +//#define NDEBUG +#include + /* FUNCTIONS *****************************************************************/ PNSQUERY_PROVIDER @@ -83,25 +86,20 @@ { INT ErrorCode = ERROR_SUCCESS; LPNSPSTARTUP NSPStartupProc; - CHAR AnsiPath[MAX_PATH], ExpandedDllPath[MAX_PATH]; - - /* Convert the path to ANSI */ - WideCharToMultiByte(CP_ACP, - 0, - DllName, - -1, - AnsiPath, - MAX_PATH, - NULL, - NULL); + WCHAR ExpandedDllPath[MAX_PATH]; /* Expand the DLL Path */ - ExpandEnvironmentStringsA(AnsiPath, + if (!ExpandEnvironmentStringsW(DllName, ExpandedDllPath, - MAX_PATH); + MAX_PATH)) + { + /* Fail */ + ErrorCode = WSAEPROVIDERFAILEDINIT; + goto Fail; + } /* Load the DLL */ - Provider->DllHandle = LoadLibraryA(ExpandedDllPath); + Provider->DllHandle = LoadLibraryW(ExpandedDllPath); if (!Provider->DllHandle) { /* Fail */ @@ -120,7 +118,13 @@ } /* Call it */ - (*NSPStartupProc)(ProviderId, &Provider->Service); + ErrorCode = (*NSPStartupProc)(ProviderId, &Provider->Service); + if (ErrorCode) + { + /* Fail */ + ErrorCode = WSAEPROVIDERFAILEDINIT; + goto Fail; + } /* Save the provider ID */ Provider->ProviderId = *ProviderId; @@ -227,6 +231,11 @@ WsNpLookupServiceEnd(IN PNS_PROVIDER Provider, IN HANDLE LookupHandle) { + if (!Provider->Service.NSPLookupServiceEnd) + { + DPRINT("NSPLookupServiceEnd not supported by the provider\n"); + return WSAEOPNOTSUPP; + } /* Call the NSP */ return Provider->Service.NSPLookupServiceEnd(LookupHandle); } @@ -239,6 +248,11 @@ OUT PDWORD BufferLength, OUT LPWSAQUERYSETW Results) { + if (!Provider->Service.NSPLookupServiceNext) + { + DPRINT("NSPLookupServiceNext not supported by the provider\n"); + return WSAEOPNOTSUPP; + } /* Call the NSP */ return Provider->Service.NSPLookupServiceNext(LookupHandle, ControlFlags, @@ -254,6 +268,11 @@ IN DWORD ControlFlags, OUT PHANDLE LookupHandle) { + if (!Provider->Service.NSPLookupServiceBegin) + { + DPRINT("NSPLookupServiceBegin not supported by the provider\n"); + return WSAEOPNOTSUPP; + } /* Call the NSP */ return Provider->Service.NSPLookupServiceBegin(&Provider->ProviderId, Restrictions,