Click here to Skip to main content
16,011,839 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMFC Doc/View and CButton Pin
Walt Austin9-Apr-07 16:04
Walt Austin9-Apr-07 16:04 
AnswerRe: MFC Doc/View and CButton Pin
Mark Salsbery9-Apr-07 16:36
Mark Salsbery9-Apr-07 16:36 
GeneralRe: MFC Doc/View and CButton Pin
Dosin9-Apr-07 19:49
Dosin9-Apr-07 19:49 
GeneralRe: MFC Doc/View and CButton Pin
Walt Austin10-Apr-07 2:11
Walt Austin10-Apr-07 2:11 
GeneralRe: MFC Doc/View and CButton Pin
Walt Austin10-Apr-07 2:08
Walt Austin10-Apr-07 2:08 
GeneralRe: MFC Doc/View and CButton Pin
Mark Salsbery10-Apr-07 7:04
Mark Salsbery10-Apr-07 7:04 
QuestionRe: MFC Doc/View and CButton Pin
David Crow10-Apr-07 2:29
David Crow10-Apr-07 2:29 
QuestionDLL fails on 9x platform, runs on NT platform Pin
JeffRoz9-Apr-07 14:14
JeffRoz9-Apr-07 14:14 
Here is some code I wrote that needs to be called from a Win32 exe. The Win32 exe needs to run on both 9x and NT platforms. The code compiles with no problem on VS 2005, but the DLL will not load when run in 9x.

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 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) *************************






************************* 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

************************* VB EXE that calls DLL *************************
AnswerRe: DLL fails on 9x platform, runs on NT platform Pin
Rick York9-Apr-07 15:54
mveRick York9-Apr-07 15:54 
GeneralRe: DLL fails on 9x platform, runs on NT platform Pin
JeffRoz9-Apr-07 16:49
JeffRoz9-Apr-07 16:49 
GeneralRe: DLL fails on 9x platform, runs on NT platform Pin
Steve S10-Apr-07 0:16
Steve S10-Apr-07 0:16 
GeneralRe: DLL fails on 9x platform, runs on NT platform Pin
JeffRoz10-Apr-07 3:09
JeffRoz10-Apr-07 3:09 
GeneralRe: DLL fails on 9x platform, runs on NT platform Pin
JudyL_MD10-Apr-07 7:36
JudyL_MD10-Apr-07 7:36 
GeneralRe: DLL fails on 9x platform, runs on NT platform Pin
JeffRoz10-Apr-07 8:43
JeffRoz10-Apr-07 8:43 
GeneralRe: DLL fails on 9x platform, runs on NT platform Pin
JudyL_MD10-Apr-07 8:55
JudyL_MD10-Apr-07 8:55 
GeneralRe: DLL fails on 9x platform, runs on NT platform Pin
JeffRoz10-Apr-07 17:26
JeffRoz10-Apr-07 17:26 
QuestionRe: DLL fails on 9x platform, runs on NT platform Pin
JeffRoz16-Apr-07 5:26
JeffRoz16-Apr-07 5:26 
AnswerRe: DLL fails on 9x platform, runs on NT platform Pin
JudyL_MD16-Apr-07 6:05
JudyL_MD16-Apr-07 6:05 
QuestionHow to send update text message with only standard windows library Pin
theFrenchHornet9-Apr-07 12:55
theFrenchHornet9-Apr-07 12:55 
AnswerRe: How to send update text message with only standard windows library Pin
Mark Salsbery9-Apr-07 16:38
Mark Salsbery9-Apr-07 16:38 
GeneralRe: How to send update text message with only standard windows library Pin
theFrenchHornet10-Apr-07 4:27
theFrenchHornet10-Apr-07 4:27 
GeneralRe: How to send update text message with only standard windows library Pin
theFrenchHornet10-Apr-07 4:45
theFrenchHornet10-Apr-07 4:45 
AnswerRe: How to send update text message with only standard windows library Pin
prasad_som9-Apr-07 18:36
prasad_som9-Apr-07 18:36 
GeneralRe: How to send update text message with only standard windows library Pin
theFrenchHornet10-Apr-07 4:46
theFrenchHornet10-Apr-07 4:46 
QuestionNeed help on game creation Pin
thesad9-Apr-07 10:15
thesad9-Apr-07 10:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.