It runs under NT, and only if I uncomment the "//return" line, will it run under 9x. LsaOpenPolicy is an NT platform API - it's as though the DLL is calling or referencing the LsaOpenPolicy even when blocked by an (if) statement on 9x. Is it something obvious I'm missing I dont' want to create two DLLs, one for 9x and another for NT.
************************* DLL (host.dll) *************************
#include <windows.h>
#include <ntsecapi.h>
NTSTATUS GetLsa();
NTSTATUS ntsTemp;
BOOL bIsNTPlatform;
...
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
{
OSVERSIONINFOEX osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if (!GetVersionEx((OSVERSIONINFO *) &osvi))
{
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (!GetVersionEx((OSVERSIONINFO *)&osvi))
return FALSE;
}
bIsNTPlatform = (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT);
if (bIsNTPlatform)
ntsTemp = GetLsa();
return TRUE;
}
NTSTATUS GetLsa()
{
LSA_HANDLE hPolicy = LSA_HANDLE(0);
LSA_OBJECT_ATTRIBUTES ObjectAttributes;
//return 1;
return LsaOpenPolicy(NULL, &ObjectAttributes, POLICY_VIEW_LOCAL_INFORMATION, &hPolicy);
}
************************* DLL (host.dll) *************************
************************* Simple VB EXE that calls DLL *************************
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Sub Main()
MsgBox LoadLibrary(App.Path & "\host.dll"), , "LoadLibrary")
End Sub
************************* Simple VB EXE that calls DLL *************************