summaryrefslogtreecommitdiffstats
path: root/PC/frozen_dllmain.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-05-09 16:14:21 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-05-09 16:14:21 (GMT)
commit7f14f0d8a0228c50d5b5de2acbfe9a64ebc6749a (patch)
treed25489e9531c01f1e9244012bbfaa929f382883e /PC/frozen_dllmain.c
parentb7d943625cf4353f6cb72df16252759f2dbd8e06 (diff)
downloadcpython-7f14f0d8a0228c50d5b5de2acbfe9a64ebc6749a.zip
cpython-7f14f0d8a0228c50d5b5de2acbfe9a64ebc6749a.tar.gz
cpython-7f14f0d8a0228c50d5b5de2acbfe9a64ebc6749a.tar.bz2
Recorded merge of revisions 81032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines Recorded merge of revisions 81029 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........ ................
Diffstat (limited to 'PC/frozen_dllmain.c')
-rw-r--r--PC/frozen_dllmain.c116
1 files changed, 58 insertions, 58 deletions
diff --git a/PC/frozen_dllmain.c b/PC/frozen_dllmain.c
index fbb4713..a8cc885 100644
--- a/PC/frozen_dllmain.c
+++ b/PC/frozen_dllmain.c
@@ -9,7 +9,7 @@ a frozen application, this DLLMain symbol exists multiple times.
The solution is:
* Each module checks for a frozen build, and if so, defines its DLLMain
- function as "__declspec(dllexport) DllMain%module%"
+ function as "__declspec(dllexport) DllMain%module%"
(eg, DllMainpythoncom, or DllMainpywintypes)
* The frozen .EXE/.DLL links against this module, which provides
@@ -47,10 +47,10 @@ changed, here is a snippet from the pythoncom extension module.
#include "windows.h"
static char *possibleModules[] = {
- "pywintypes",
- "pythoncom",
- "win32ui",
- NULL,
+ "pywintypes",
+ "pythoncom",
+ "win32ui",
+ NULL,
};
BOOL CallModuleDllMain(char *modName, DWORD dwReason);
@@ -62,73 +62,73 @@ BOOL CallModuleDllMain(char *modName, DWORD dwReason);
*/
void PyWinFreeze_ExeInit(void)
{
- char **modName;
- for (modName = possibleModules;*modName;*modName++) {
-/* printf("Initialising '%s'\n", *modName); */
- CallModuleDllMain(*modName, DLL_PROCESS_ATTACH);
- }
+ char **modName;
+ for (modName = possibleModules;*modName;*modName++) {
+/* printf("Initialising '%s'\n", *modName); */
+ CallModuleDllMain(*modName, DLL_PROCESS_ATTACH);
+ }
}
/*
Called by a frozen .EXE only, so that built-in extension
- modules are cleaned up
+ modules are cleaned up
*/
void PyWinFreeze_ExeTerm(void)
{
- // Must go backwards
- char **modName;
- for (modName = possibleModules+(sizeof(possibleModules) / sizeof(char *))-2;
- modName >= possibleModules;
- *modName--) {
-/* printf("Terminating '%s'\n", *modName);*/
- CallModuleDllMain(*modName, DLL_PROCESS_DETACH);
- }
+ // Must go backwards
+ char **modName;
+ for (modName = possibleModules+(sizeof(possibleModules) / sizeof(char *))-2;
+ modName >= possibleModules;
+ *modName--) {
+/* printf("Terminating '%s'\n", *modName);*/
+ CallModuleDllMain(*modName, DLL_PROCESS_DETACH);
+ }
}
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
- BOOL ret = TRUE;
- switch (dwReason) {
- case DLL_PROCESS_ATTACH:
- {
- char **modName;
- for (modName = possibleModules;*modName;*modName++) {
- BOOL ok = CallModuleDllMain(*modName, dwReason);
- if (!ok)
- ret = FALSE;
- }
- break;
- }
- case DLL_PROCESS_DETACH:
- {
- // Must go backwards
- char **modName;
- for (modName = possibleModules+(sizeof(possibleModules) / sizeof(char *))-2;
- modName >= possibleModules;
- *modName--)
- CallModuleDllMain(*modName, DLL_PROCESS_DETACH);
- break;
- }
- }
- return ret;
+ BOOL ret = TRUE;
+ switch (dwReason) {
+ case DLL_PROCESS_ATTACH:
+ {
+ char **modName;
+ for (modName = possibleModules;*modName;*modName++) {
+ BOOL ok = CallModuleDllMain(*modName, dwReason);
+ if (!ok)
+ ret = FALSE;
+ }
+ break;
+ }
+ case DLL_PROCESS_DETACH:
+ {
+ // Must go backwards
+ char **modName;
+ for (modName = possibleModules+(sizeof(possibleModules) / sizeof(char *))-2;
+ modName >= possibleModules;
+ *modName--)
+ CallModuleDllMain(*modName, DLL_PROCESS_DETACH);
+ break;
+ }
+ }
+ return ret;
}
BOOL CallModuleDllMain(char *modName, DWORD dwReason)
{
- BOOL (WINAPI * pfndllmain)(HINSTANCE, DWORD, LPVOID);
-
- char funcName[255];
- HMODULE hmod = GetModuleHandle(NULL);
- strcpy(funcName, "_DllMain");
- strcat(funcName, modName);
- strcat(funcName, "@12"); // stdcall convention.
- pfndllmain = (BOOL (WINAPI *)(HINSTANCE, DWORD, LPVOID))GetProcAddress(hmod, funcName);
- if (pfndllmain==NULL) {
- /* No function by that name exported - then that module does
- not appear in our frozen program - return OK
- */
- return TRUE;
- }
- return (*pfndllmain)(hmod, dwReason, NULL);
+ BOOL (WINAPI * pfndllmain)(HINSTANCE, DWORD, LPVOID);
+
+ char funcName[255];
+ HMODULE hmod = GetModuleHandle(NULL);
+ strcpy(funcName, "_DllMain");
+ strcat(funcName, modName);
+ strcat(funcName, "@12"); // stdcall convention.
+ pfndllmain = (BOOL (WINAPI *)(HINSTANCE, DWORD, LPVOID))GetProcAddress(hmod, funcName);
+ if (pfndllmain==NULL) {
+ /* No function by that name exported - then that module does
+ not appear in our frozen program - return OK
+ */
+ return TRUE;
+ }
+ return (*pfndllmain)(hmod, dwReason, NULL);
}