6 /* Print a debug message to the installer log file.
7 * To see the debug messages, install with
8 * msiexec /i pythonxy.msi /l*v python.log
10 static UINT
debug(MSIHANDLE hInstall
, LPCSTR msg
)
12 MSIHANDLE hRec
= MsiCreateRecord(1);
13 if (!hRec
|| MsiRecordSetStringA(hRec
, 1, msg
) != ERROR_SUCCESS
) {
14 return ERROR_INSTALL_FAILURE
;
16 MsiProcessMessage(hInstall
, INSTALLMESSAGE_INFO
, hRec
);
21 /* Check whether the TARGETDIR exists and is a directory.
22 * Set TargetExists appropriately.
24 UINT
__declspec(dllexport
) __stdcall
CheckDir(MSIHANDLE hInstall
)
33 isWinNT
= (GetVersion() < 0x80000000) ? 1 : 0;
36 result
= MsiGetPropertyW(hInstall
, L
"TARGETDIR", wpath
, &size
);
38 result
= MsiGetPropertyA(hInstall
, "TARGETDIR", path
, &size
);
39 if (result
!= ERROR_SUCCESS
)
45 attributes
= GetFileAttributesW(wpath
);
47 attributes
= GetFileAttributesA(path
);
48 if (attributes
== INVALID_FILE_ATTRIBUTES
||
49 !(attributes
& FILE_ATTRIBUTE_DIRECTORY
))
51 return MsiSetPropertyA(hInstall
, "TargetExists", "0");
53 return MsiSetPropertyA(hInstall
, "TargetExists", "1");
57 /* Update the state of the REGISTRY.tcl component according to the
58 * Extension and TclTk features. REGISTRY.tcl must be installed
59 * if both features are installed, and must be absent otherwise.
61 UINT
__declspec(dllexport
) __stdcall
UpdateEditIDLE(MSIHANDLE hInstall
)
63 INSTALLSTATE ext_old
, ext_new
, tcl_old
, tcl_new
, reg_new
;
66 result
= MsiGetFeatureStateA(hInstall
, "Extensions", &ext_old
, &ext_new
);
67 if (result
!= ERROR_SUCCESS
)
69 result
= MsiGetFeatureStateA(hInstall
, "TclTk", &tcl_old
, &tcl_new
);
70 if (result
!= ERROR_SUCCESS
)
73 /* If the current state is Absent, and the user did not select
74 the feature in the UI, Installer apparently sets the "selected"
75 state to unknown. Update it to the current value, then. */
76 if (ext_new
== INSTALLSTATE_UNKNOWN
)
78 if (tcl_new
== INSTALLSTATE_UNKNOWN
)
81 // XXX consider current state of REGISTRY.tcl?
82 if (((tcl_new
== INSTALLSTATE_LOCAL
) ||
83 (tcl_new
== INSTALLSTATE_SOURCE
) ||
84 (tcl_new
== INSTALLSTATE_DEFAULT
)) &&
85 ((ext_new
== INSTALLSTATE_LOCAL
) ||
86 (ext_new
== INSTALLSTATE_SOURCE
) ||
87 (ext_new
== INSTALLSTATE_DEFAULT
))) {
88 reg_new
= INSTALLSTATE_SOURCE
;
90 reg_new
= INSTALLSTATE_ABSENT
;
92 result
= MsiSetComponentStateA(hInstall
, "REGISTRY.tcl", reg_new
);
96 BOOL APIENTRY
DllMain(HANDLE hModule
,
97 DWORD ul_reason_for_call
,