wine/dlls/commdlg/generic.c
Alexandre Julliard 0799c1a780 Added LGPL standard comment, and copyright notices where necessary.
Global replacement of debugtools.h by wine/debug.h.
2002-03-09 23:29:33 +00:00

86 lines
2.3 KiB
C

/*
* COMMDLG/COMDLG32 functions
*
* Copyright 1994 Martin Ayotte
* Copyright 1996 Albrecht Kleine
* Copyright 1998,1999 Bertho Stultiens
* Copyright 1999 Klaas van Gend
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "winbase.h"
#include "commdlg.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
#include "cdlg.h"
HINSTANCE16 COMMDLG_hInstance = 0;
HINSTANCE COMMDLG_hInstance32 = 0;
static int COMMDLG_Attach = 0;
/***********************************************************************
* DllEntryPoint [COMMDLG.32]
*
* Initialization code for the COMMDLG DLL
*
* RETURNS:
*/
BOOL WINAPI COMMDLG_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD HeapSize, DWORD res1, WORD res2)
{
TRACE("(%08lx, %04x, %04x, %04x, %08lx, %04x)\n", Reason, hInst, ds, HeapSize, res1, res2);
switch(Reason)
{
case DLL_PROCESS_ATTACH:
if (COMMDLG_Attach++) break;
COMMDLG_hInstance = hInst;
if(!COMMDLG_hInstance32)
{
if(!(COMMDLG_hInstance32 = LoadLibraryA("comdlg32.dll")))
{
ERR("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;
}
/***********************************************************************
* CommDlgExtendedError16 [COMMDLG.26]
*
* Get the last error value if a commdlg function fails.
* RETURNS
* Current error value which might not be valid
* if a previous call succeeded.
*/
DWORD WINAPI CommDlgExtendedError16(void)
{
return CommDlgExtendedError();
}