+++ /dev/null
-#include "windows.h"\r
-#include "msiquery.h"\r
-\r
-/* Print a debug message to the installer log file.\r
- * To see the debug messages, install with\r
- * msiexec /i pythonxy.msi /l*v python.log\r
- */\r
-static UINT debug(MSIHANDLE hInstall, LPCSTR msg)\r
-{\r
- MSIHANDLE hRec = MsiCreateRecord(1);\r
- if (!hRec || MsiRecordSetStringA(hRec, 1, msg) != ERROR_SUCCESS) {\r
- return ERROR_INSTALL_FAILURE;\r
- }\r
- MsiProcessMessage(hInstall, INSTALLMESSAGE_INFO, hRec);\r
- MsiCloseHandle(hRec);\r
- return ERROR_SUCCESS;\r
-}\r
-\r
-/* Check whether the TARGETDIR exists and is a directory.\r
- * Set TargetExists appropriately.\r
- */\r
-UINT __declspec(dllexport) __stdcall CheckDir(MSIHANDLE hInstall)\r
-{\r
-#define PSIZE 1024\r
- WCHAR wpath[PSIZE];\r
- char path[PSIZE];\r
- UINT result;\r
- DWORD size = PSIZE;\r
- DWORD attributes;\r
-\r
-\r
- result = MsiGetPropertyW(hInstall, L"TARGETDIR", wpath, &size);\r
- if (result != ERROR_SUCCESS)\r
- return result;\r
- wpath[size] = L'\0';\r
- path[size] = L'\0';\r
-\r
- attributes = GetFileAttributesW(wpath);\r
- if (attributes == INVALID_FILE_ATTRIBUTES ||\r
- !(attributes & FILE_ATTRIBUTE_DIRECTORY))\r
- {\r
- return MsiSetPropertyA(hInstall, "TargetExists", "0");\r
- } else {\r
- return MsiSetPropertyA(hInstall, "TargetExists", "1");\r
- }\r
-}\r
-\r
-/* Update the state of the REGISTRY.tcl component according to the\r
- * Extension and TclTk features. REGISTRY.tcl must be installed\r
- * if both features are installed, and must be absent otherwise.\r
- */\r
-UINT __declspec(dllexport) __stdcall UpdateEditIDLE(MSIHANDLE hInstall)\r
-{\r
- INSTALLSTATE ext_old, ext_new, tcl_old, tcl_new, reg_new;\r
- UINT result;\r
-\r
- result = MsiGetFeatureStateA(hInstall, "Extensions", &ext_old, &ext_new);\r
- if (result != ERROR_SUCCESS)\r
- return result;\r
- result = MsiGetFeatureStateA(hInstall, "TclTk", &tcl_old, &tcl_new);\r
- if (result != ERROR_SUCCESS)\r
- return result;\r
-\r
- /* If the current state is Absent, and the user did not select\r
- the feature in the UI, Installer apparently sets the "selected"\r
- state to unknown. Update it to the current value, then. */\r
- if (ext_new == INSTALLSTATE_UNKNOWN)\r
- ext_new = ext_old;\r
- if (tcl_new == INSTALLSTATE_UNKNOWN)\r
- tcl_new = tcl_old;\r
-\r
- // XXX consider current state of REGISTRY.tcl?\r
- if (((tcl_new == INSTALLSTATE_LOCAL) ||\r
- (tcl_new == INSTALLSTATE_SOURCE) ||\r
- (tcl_new == INSTALLSTATE_DEFAULT)) &&\r
- ((ext_new == INSTALLSTATE_LOCAL) ||\r
- (ext_new == INSTALLSTATE_SOURCE) ||\r
- (ext_new == INSTALLSTATE_DEFAULT))) {\r
- reg_new = INSTALLSTATE_SOURCE;\r
- } else {\r
- reg_new = INSTALLSTATE_ABSENT;\r
- }\r
- result = MsiSetComponentStateA(hInstall, "REGISTRY.tcl", reg_new);\r
- return result;\r
-}\r
-\r
-BOOL APIENTRY DllMain(HANDLE hModule,\r
- DWORD ul_reason_for_call,\r
- LPVOID lpReserved)\r
-{\r
- return TRUE;\r
-}\r
-\r