From: Brian S. <xue...@us...> - 2007-11-03 11:06:43
|
Update of /cvsroot/popfile/windows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27738 Modified Files: Tag: b0_22_2 pfi-library.nsh Log Message: Conditional compilation controls updated to support the "User Data BRU" package. PFI_CheckIfLocked improved by allowing it to check ordinary files in addition to *.exe and *.dll files. The plugin's "AddFile" mode was far too slow for the BRU so it was replaced by Win9x-compatible code which is good enough for the database tests used by the BRU. Also made this function more robust (i.e. made it avoid an infinite loop!) by checking for stack exhaustion when accessing the input list of files. Index: pfi-library.nsh =================================================================== RCS file: /cvsroot/popfile/windows/pfi-library.nsh,v retrieving revision 1.53.4.13 retrieving revision 1.53.4.14 diff -C2 -d -r1.53.4.13 -r1.53.4.14 *** pfi-library.nsh 21 Oct 2007 22:15:50 -0000 1.53.4.13 --- pfi-library.nsh 3 Nov 2007 11:06:44 -0000 1.53.4.14 *************** *** 60,64 **** #-------------------------------------------------------------------------- ! !define C_PFI_LIBRARY_VERSION "0.3.7" #-------------------------------------------------------------------------- --- 60,64 ---- #-------------------------------------------------------------------------- ! !define C_PFI_LIBRARY_VERSION "0.3.11" #-------------------------------------------------------------------------- *************** *** 844,848 **** ! !ifdef ADDUSER | TRANSLATOR_AUW #-------------------------------------------------------------------------- # Installer Function: PFI_StrStripLZS --- 844,848 ---- ! !ifdef ADDUSER | BACKUP | RESTORE | TRANSLATOR_AUW #-------------------------------------------------------------------------- # Installer Function: PFI_StrStripLZS *************** *** 1115,1120 **** # # The installation process and the uninstall process may both require a function ! # which checks if a particular executable file (an EXE file) is being used. This ! # macro makes maintenance easier by ensuring that both processes use identical # functions, with the only difference being their names. # --- 1115,1120 ---- # # The installation process and the uninstall process may both require a function ! # which checks if a particular executable file (usually an EXE file) is being used. ! # This macro makes maintenance easier by ensuring that both processes use identical # functions, with the only difference being their names. # *************** *** 1125,1129 **** # # Normally the LockedList plugin will be used to check if any of the specified ! # executable files is use. This plugin returns its results on the stack, # sandwiched between "/start" and "/end" markers ("/start" appears at the top # of the stack). If no files are locked, the plugin simply returns both of these --- 1125,1129 ---- # # Normally the LockedList plugin will be used to check if any of the specified ! # executable files is in use. This plugin returns its results on the stack, # sandwiched between "/start" and "/end" markers ("/start" appears at the top # of the stack). If no files are locked, the plugin simply returns both of these *************** *** 1144,1147 **** --- 1144,1152 ---- # through the results looking for a match. # + # This function is normally used to check if a particular executable (.exe) file is + # locked. However to make the function more general purpose it checks if a DLL has + # been specified and treats that as an executable. All other filenames are assumed + # to be ordinary files. + # #------------------------------------------------------------------------------------ # *************** *** 1186,1190 **** # Usage (after macro has been 'inserted'): # ! # Push "/EndOfExeList" # Push "$INSTDIR\wperl.exe" # Call PFI_CheckIfLocked --- 1191,1195 ---- # Usage (after macro has been 'inserted'): # ! # Push "${C_EXE_END_MARKER}" # Push "$INSTDIR\wperl.exe" # Call PFI_CheckIfLocked *************** *** 1217,1221 **** --- 1222,1228 ---- get_exe_path: + ClearErrors Pop $G_CIL_PATH + IfErrors panic StrCmp $G_CIL_PATH "${C_EXE_END_MARKER}" list_exhausted StrCmp $G_CIL_FLAG "" 0 get_exe_path *************** *** 1243,1254 **** IntOp $G_CIL_TEMP $G_CIL_TEMP + 1 StrCpy $G_CIL_FILE $G_CIL_FILE "" $G_CIL_TEMP LockedList::AddModule /NOUNLOAD "\$G_CIL_FILE" LockedList::SilentSearch Pop $G_CIL_TEMP StrCmp $G_CIL_TEMP "/start" get_search_result ! MessageBox MB_OK|MB_ICONEXCLAMATION "Unexpected result from LockedList plugin\ ${MB_NL}${MB_NL}\ ($G_CIL_TEMP)" ! Abort get_search_result: --- 1250,1277 ---- IntOp $G_CIL_TEMP $G_CIL_TEMP + 1 StrCpy $G_CIL_FILE $G_CIL_FILE "" $G_CIL_TEMP + StrCpy $G_CIL_TEMP $G_CIL_FILE "" -4 + StrCmp $G_CIL_TEMP ".exe" check_module + StrCmp $G_CIL_TEMP ".dll" check_module + + ; Assume the file is "our" POPFile database so there is no need to use + ; the LockedList plugin's "AddFile" mode to check if the file is locked + + SetFileAttributes "$G_CIL_PATH\$G_CIL_FILE" NORMAL + ClearErrors + FileOpen $G_CIL_TEMP "$G_CIL_PATH\$G_CIL_FILE" a + FileClose $G_CIL_TEMP + IfErrors 0 get_exe_path + StrCpy $G_CIL_FLAG "$G_CIL_PATH\$G_CIL_FILE" + Goto get_exe_path + + check_module: LockedList::AddModule /NOUNLOAD "\$G_CIL_FILE" LockedList::SilentSearch Pop $G_CIL_TEMP StrCmp $G_CIL_TEMP "/start" get_search_result ! MessageBox MB_OK|MB_ICONSTOP "Unexpected result from LockedList plugin\ ${MB_NL}${MB_NL}\ ($G_CIL_TEMP)" ! Abort "Unexpected result from LockedList plugin ($G_CIL_TEMP)" get_search_result: *************** *** 1276,1279 **** --- 1299,1312 ---- Goto exit + panic: + MessageBox MB_OK|MB_ICONSTOP "Internal Error:\ + ${MB_NL}${MB_NL}\ + '${UN}PFI_CheckIfLocked' function did not find\ + ${MB_NL}\ + the '${C_EXE_END_MARKER}' marker on the stack!" + Abort "Internal Error: \ + '${UN}PFI_CheckIfLocked' function did not find the \ + '${C_EXE_END_MARKER}' marker on the stack!" + ; Windows 95, 98, ME and NT3.x are treated as special cases ; (because they do not support the LockedList plugin) *************** *** 1283,1287 **** --- 1316,1322 ---- loop: + ClearErrors Pop $G_CIL_PATH + IfErrors panic StrCmp $G_CIL_PATH "${C_EXE_END_MARKER}" allread StrCmp $G_CIL_FLAG "" 0 loop *************** *** 1666,1670 **** !macroend ! !ifdef ADDUSER | DBSTATUS | INSTALLER | MONITORCC | ONDEMAND | RESTORE #-------------------------------------------------------------------------- # Installer Function: PFI_GetCompleteFPN --- 1701,1705 ---- !macroend ! !ifdef ADDUSER | BACKUP | DBSTATUS | INSTALLER | MONITORCC | ONDEMAND | RESTORE #-------------------------------------------------------------------------- # Installer Function: PFI_GetCompleteFPN *************** *** 2836,2840 **** !macroend ! !ifndef BACKUP & ONDEMAND #-------------------------------------------------------------------------- # Installer Function: PFI_GetParameters --- 2871,2875 ---- !macroend ! !ifndef ONDEMAND #-------------------------------------------------------------------------- # Installer Function: PFI_GetParameters |