2 * COMMDLG/COMDLG32 functions
4 * Copyright 1994 Martin Ayotte
5 * Copyright 1996 Albrecht Kleine
6 * Copyright 1998 Bertho Stultiens
7 * Copyright 1999 Klaas van Gend
20 DEFAULT_DEBUG_CHANNEL(commdlg)
23 #define COMDLG32_LAST_ERROR_NOT_ALLOCATED 0xF684F684
24 static DWORD COMDLG32_TlsIndex = COMDLG32_LAST_ERROR_NOT_ALLOCATED;
26 /***********************************************************************
27 * COMDLG32_DllEntryPoint [COMDLG32.entry]
29 * Initialisation code for the COMDLG32 DLL
30 * This call should implement the allocation of the TLS.
35 * Remains unimplemented until Bertho finishes his ELF-DLL code
37 BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance,
44 /***********************************************************************
45 * COMDLG32_AllocTlsForCommDlgExtError [internal]
47 * Allocates Thread Local Storage for the ComDlg32 local
54 * 1) FIXME: This function is only temporary, as this code *SHOULD*
55 * be executed in the DLL Entrypoint. For now, it is done
57 * 2) This allocated memory is NEVER freed again!
59 void COMDLG32_AllocTlsForCommDlgExtError()
61 FIXME(commdlg, "TLS for CommDlgExtendedError allocated on-the-fly\n");
62 if (COMDLG32_TlsIndex == COMDLG32_LAST_ERROR_NOT_ALLOCATED)
63 COMDLG32_TlsIndex = TlsAlloc();
64 if (COMDLG32_TlsIndex == 0xFFFFFFFF)
65 ERR(commdlg, "No space for COMDLG32 TLS\n");
68 /***********************************************************************
69 * COMDLG32_SetCommDlgExtendedError [internal]
71 * Used to set the thread's local error value if a comdlg32 function fails.
73 void COMDLG32_SetCommDlgExtendedError(DWORD err)
75 /*FIXME: This check and the resulting alloc should be removed
76 * when the DLL Entry code is finished
78 if (COMDLG32_TlsIndex==COMDLG32_LAST_ERROR_NOT_ALLOCATED)
79 COMDLG32_AllocTlsForCommDlgExtError();
80 TlsSetValue(COMDLG32_TlsIndex, (void *)err);
84 /***********************************************************************
85 * CommDlgExtendedError [COMDLG32.5]
87 * Get the thread's local error value if a comdlg32 function fails.
89 * Current error value which might not be valid
90 * if a previous call succeeded.
92 DWORD WINAPI CommDlgExtendedError(void)
94 /*FIXME: This check and the resulting alloc should be removed
95 * when the DLL Entry code is finished
97 if (COMDLG32_TlsIndex==COMDLG32_LAST_ERROR_NOT_ALLOCATED)
98 COMDLG32_AllocTlsForCommDlgExtError();
99 return (DWORD)TlsGetValue(COMDLG32_TlsIndex);