Replaced some GetProcAddress() imports by the standard dll import
[wine.git] / dlls / commdlg / generic.c
blob24fd66d382b5e6ce1d0bad457904b1400e9cd8ba
1 /*
2 * COMMDLG/COMDLG32 functions
4 * Copyright 1994 Martin Ayotte
5 * Copyright 1996 Albrecht Kleine
6 * Copyright 1998,1999 Bertho Stultiens
7 * Copyright 1999 Klaas van Gend
8 */
10 #include "winbase.h"
11 #include "commdlg.h"
12 #include "debugtools.h"
14 DEFAULT_DEBUG_CHANNEL(commdlg);
16 #include "cdlg.h"
18 HINSTANCE16 COMMDLG_hInstance = 0;
19 HINSTANCE COMMDLG_hInstance32 = 0;
20 static int COMMDLG_Attach = 0;
22 /***********************************************************************
23 * COMMDLG_DllEntryPoint [COMMDLG.entry]
25 * Initialization code for the COMMDLG DLL
27 * RETURNS:
29 BOOL WINAPI COMMDLG_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD HeapSize, DWORD res1, WORD res2)
31 TRACE("(%08lx, %04x, %04x, %04x, %08lx, %04x)\n", Reason, hInst, ds, HeapSize, res1, res2);
32 switch(Reason)
34 case DLL_PROCESS_ATTACH:
35 if (COMMDLG_Attach++) break;
36 COMMDLG_hInstance = hInst;
37 if(!COMMDLG_hInstance32)
39 if(!(COMMDLG_hInstance32 = LoadLibraryA("comdlg32.dll")))
41 ERR("Could not load sibling comdlg32.dll\n");
42 return FALSE;
45 break;
47 case DLL_PROCESS_DETACH:
48 if(!--COMMDLG_Attach)
50 COMMDLG_hInstance = 0;
51 if(COMMDLG_hInstance32)
52 FreeLibrary(COMMDLG_hInstance32);
54 break;
56 return TRUE;
60 /***********************************************************************
61 * CommDlgExtendedError16 [COMMDLG.26]
63 * Get the last error value if a commdlg function fails.
64 * RETURNS
65 * Current error value which might not be valid
66 * if a previous call succeeded.
68 DWORD WINAPI CommDlgExtendedError16(void)
70 return CommDlgExtendedError();