1999-02-28 21:05:11 +01:00
|
|
|
/*
|
1999-03-15 16:16:54 +01:00
|
|
|
* COMMDLG/COMDLG32 functions
|
1999-02-28 21:05:11 +01:00
|
|
|
*
|
|
|
|
* Copyright 1994 Martin Ayotte
|
|
|
|
* Copyright 1996 Albrecht Kleine
|
1999-04-25 20:31:35 +02:00
|
|
|
* Copyright 1998,1999 Bertho Stultiens
|
1999-02-28 21:05:11 +01:00
|
|
|
* Copyright 1999 Klaas van Gend
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "commdlg.h"
|
|
|
|
#include "debug.h"
|
|
|
|
|
1999-04-19 16:56:29 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(commdlg)
|
|
|
|
|
1999-04-25 20:31:35 +02:00
|
|
|
#include "cdlg.h"
|
1999-03-15 16:16:54 +01:00
|
|
|
|
1999-04-25 20:31:35 +02:00
|
|
|
HINSTANCE16 COMMDLG_hInstance = 0;
|
|
|
|
HINSTANCE COMMDLG_hInstance32 = 0;
|
|
|
|
static int COMMDLG_Attach = 0;
|
1999-03-15 16:16:54 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
1999-04-25 20:31:35 +02:00
|
|
|
* COMMDLG_DllEntryPoint [COMMDLG.entry]
|
1999-03-15 16:16:54 +01:00
|
|
|
*
|
1999-04-25 20:31:35 +02:00
|
|
|
* Initialization code for the COMMDLG DLL
|
1999-03-15 16:16:54 +01:00
|
|
|
*
|
|
|
|
* RETURNS:
|
|
|
|
*/
|
1999-04-25 20:31:35 +02:00
|
|
|
BOOL WINAPI COMMDLG_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD HeapSize, DWORD res1, WORD res2)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
1999-04-25 20:31:35 +02:00
|
|
|
TRACE(commdlg, "(%08lx, %04x, %04x, %04x, %08lx, %04x)\n", Reason, hInst, ds, HeapSize, res1, res2);
|
|
|
|
switch(Reason)
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
COMMDLG_Attach++;
|
|
|
|
if(COMMDLG_hInstance)
|
|
|
|
{
|
|
|
|
ERR(commdlg, "commdlg.dll instantiated twice!\n");
|
|
|
|
/*
|
|
|
|
* We should return FALSE here, but that will break
|
|
|
|
* most apps that use CreateProcess because we do
|
|
|
|
* not yet support seperate address-spaces.
|
|
|
|
*/
|
|
|
|
return TRUE;
|
|
|
|
}
|
1999-03-15 16:16:54 +01:00
|
|
|
|
1999-04-25 20:31:35 +02:00
|
|
|
COMMDLG_hInstance = hInst;
|
|
|
|
if(!COMMDLG_hInstance32)
|
|
|
|
{
|
|
|
|
if(!(COMMDLG_hInstance32 = LoadLibraryA("comdlg32.dll")))
|
|
|
|
{
|
|
|
|
ERR(commdlg, "Could not load sibling comdlg32.dll\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DLL_PROCESS_DETACH:
|
|
|
|
if(!--COMMDLG_Attach)
|
|
|
|
{
|
|
|
|
COMMDLG_hInstance = 0;
|
|
|
|
if(COMMDLG_hInstance32)
|
|
|
|
FreeLibrary(COMMDLG_hInstance32);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-15 16:16:54 +01:00
|
|
|
/***********************************************************************
|
1999-04-25 20:31:35 +02:00
|
|
|
* CommDlgExtendedError16 [COMMDLG.26]
|
|
|
|
*
|
|
|
|
* Get the last error value if a commdlg function fails.
|
1999-03-15 16:16:54 +01:00
|
|
|
* RETURNS
|
|
|
|
* Current error value which might not be valid
|
|
|
|
* if a previous call succeeded.
|
|
|
|
*/
|
1999-04-25 20:31:35 +02:00
|
|
|
DWORD WINAPI CommDlgExtendedError16(void)
|
1999-03-15 16:16:54 +01:00
|
|
|
{
|
1999-04-25 20:31:35 +02:00
|
|
|
return CommDlgExtendedError();
|
1999-03-15 16:16:54 +01:00
|
|
|
}
|