int main(){ int opt=0; int num,i,option; Pila *pila= loadHeaders(); while(opt==0){ //imprimir_pila(pila); printWelcomeMessage(); headerInput(pila); num = inputNumOfStudents(); for(i =0; i<num;i++){ inputScores(); } printf("\n\n"); system("cls"); printStadistics(); option = printOptionMenu(); switch(option){ case 1: searchHeader(pila); break; case 2: printf("\n\nHeaders: \n\n"); imprimir_pila(pila); system("PAUSE"); break; case 3: eliminateHeader(pila); break; } } system("PAUSE"); return 0; }
NSIS_ENTRYPOINT_GUINOCRT EXTERN_C void NSISWinMainNOCRT() { int ret = 0; const TCHAR *m_Err = _LANG_ERRORWRITINGTEMP; int cl_flags = 0; TCHAR *realcmds; TCHAR seekchar=_T(' '); TCHAR *cmdline; InitCommonControls(); SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) { extern HRESULT g_hres; g_hres=OleInitialize(NULL); } #endif // load shfolder.dll before any script code is executed to avoid // weird situations where SetOutPath or even the extraction of // shfolder.dll will cause unexpected behavior. // // this also prevents the following: // // SetOutPath "C:\Program Files\NSIS" # maybe read from reg // File shfolder.dll // Delete $PROGRAMFILES\shfolder.dll # can't be deleted, as the // # new shfolder.dll is used // # to find its own path. g_SHGetFolderPath = myGetProcAddress(MGA_SHGetFolderPath); { // workaround for bug #1008632 // http://sourceforge.net/tracker/index.php?func=detail&aid=1008632&group_id=22049&atid=373085 // // without this, SHGetSpecialFolderLocation doesn't always recognize // some special folders, like the desktop folder for all users, on // Windows 9x. unlike SHGetSpecialFolderPath, which is not available // on all versions of Windows, SHGetSpecialFolderLocation doesn't try // too hard to make sure the caller gets what he asked for. so we give // it a little push in the right direction by doing part of the work // for it. // // part of what SHGetFileInfo does, is to convert a path into an idl. // to do this conversion, it first needs to initialize the list of // special idls, which are exactly the idls we use to get the paths // of special folders (CSIDL_*). SHFILEINFO shfi; SHGetFileInfo(_T(""), 0, &shfi, sizeof(SHFILEINFO), 0); } mystrcpy(g_caption,_LANG_GENERIC_ERROR); mystrcpy(state_command_line, GetCommandLine()); #ifdef NSIS_CONFIG_VISIBLE_SUPPORT g_hInstance = GetModuleHandle(NULL); #endif//NSIS_CONFIG_VISIBLE_SUPPORT cmdline = state_command_line; if (*cmdline == _T('\"')) seekchar = *cmdline++; cmdline=findchar(cmdline, seekchar); cmdline=CharNext(cmdline); realcmds=cmdline; while (*cmdline) { // skip over any spaces while (*cmdline == _T(' ')) cmdline++; // get char we should look for to get the next parm seekchar = _T(' '); if (cmdline[0] == _T('\"')) { cmdline++; seekchar = _T('\"'); } // is it a switch? if (cmdline[0] == _T('/')) { cmdline++; #define END_OF_ARG(c) (c == _T(' ') || c == _T('\0')) #if defined(NSIS_CONFIG_VISIBLE_SUPPORT) && defined(NSIS_CONFIG_SILENT_SUPPORT) if (cmdline[0] == _T('S') && END_OF_ARG(cmdline[1])) cl_flags |= FH_FLAGS_SILENT; #endif//NSIS_CONFIG_SILENT_SUPPORT && NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_CRC_SUPPORT if (CMP4CHAR(cmdline, _T("NCRC")) && END_OF_ARG(cmdline[4])) cl_flags |= FH_FLAGS_NO_CRC; #endif//NSIS_CONFIG_CRC_SUPPORT if (CMP4CHAR(cmdline-2, _T(" /D="))) { *(cmdline-2)=_T('\0'); // keep this from being passed to uninstaller if necessary mystrcpy(state_install_directory,cmdline+2); break; // /D= must always be last } } // skip over our parm cmdline = findchar(cmdline, seekchar); // skip the quote if (*cmdline == _T('\"')) cmdline++; } GetTempPath(NSIS_MAX_STRLEN, state_temp_dir); if (!ValidateTempDir()) { GetWindowsDirectory(state_temp_dir, NSIS_MAX_STRLEN - 5); // leave space for \Temp mystrcat(state_temp_dir, _T("\\Temp")); if (!ValidateTempDir()) { // Bug #2909242: // When running at <= Low IL we cannot write to %Temp% but we can try the temp folder used by IE. // There does not seem to be a API to get the low temp dir directly, so we build the path on our own GetTempPath(NSIS_MAX_STRLEN - 4, state_temp_dir); // leave space for \Low mystrcat(state_temp_dir, _T("Low")); // If we don't call SetEnvironmentVariable // child processes will use %temp% and not %temp%\Low // and some apps probably can't handle a read only %temp% // Do it before ValidateTempDir() because it appends a backslash. // TODO: Should this be moved to ValidateTempDir() so it also updates for %windir%\Temp? SetEnvironmentVariable(_T("TEMP"), state_temp_dir); SetEnvironmentVariable(_T("TMP"), state_temp_dir); if (!ValidateTempDir()) { goto end; } } } DeleteFile(state_language); m_Err = loadHeaders(cl_flags); if (m_Err) goto end; #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT if (g_is_uninstaller) { TCHAR *p = findchar(state_command_line, 0); // state_command_line has state_install_directory right after it in memory, so reading // a bit over state_command_line won't do any harm while (p >= state_command_line && !CMP4CHAR(p, _T(" _?="))) p--; m_Err = _LANG_UNINSTINITERROR; if (p >= state_command_line) { *p=0; // terminate before "_?=" p+=4; // skip over " _?=" if (is_valid_instpath(p)) { mystrcpy(state_install_directory, p); mystrcpy(state_output_directory, p); m_Err = 0; } else { goto end; } } else { int x; mystrcat(state_temp_dir,_T("~nsu.tmp")); // check if already running from uninstaller temp dir // this prevents recursive uninstaller calls if (!lstrcmpi(state_temp_dir,state_exe_directory)) goto end; CreateDirectory(state_temp_dir,NULL); SetCurrentDirectory(state_temp_dir); if (!state_install_directory[0]) mystrcpy(state_install_directory,state_exe_directory); mystrcpy(g_usrvars[0], realcmds); SET2CHAR(g_usrvars[1], _T("A\0")); for (x = 0; x < 26; x ++) { static TCHAR buf2[NSIS_MAX_STRLEN]; GetNSISString(buf2,g_header->str_uninstchild); // $TEMP\$1u_.exe DeleteFile(buf2); // clean up after all the other ones if they are there if (m_Err) // not done yet { // copy file if (CopyFile(state_exe_path,buf2,TRUE)) { HANDLE hProc; #ifdef NSIS_SUPPORT_MOVEONREBOOT MoveFileOnReboot(buf2,NULL); #endif GetNSISString(buf2,g_header->str_uninstcmd); // '"$TEMP\$1u_.exe" $0 _?=$INSTDIR\' hProc=myCreateProcess(buf2); if (hProc) { CloseHandle(hProc); // success m_Err = 0; } } } g_usrvars[1][0]++; } #ifdef NSIS_SUPPORT_MOVEONREBOOT MoveFileOnReboot(state_temp_dir,NULL); #endif goto end; } } #endif//NSIS_CONFIG_UNINSTALL_SUPPORT g_exec_flags.errlvl = -1; ret = ui_doinstall(); #ifdef NSIS_CONFIG_LOG #if !defined(NSIS_CONFIG_LOG_ODS) && !defined(NSIS_CONFIG_LOG_STDOUT) log_write(1); #endif//!NSIS_CONFIG_LOG_ODS && !NSIS_CONFIG_LOG_STDOUT #endif//NSIS_CONFIG_LOG end: CleanUp(); #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) OleUninitialize(); #endif if (m_Err) { my_MessageBox(m_Err, MB_OK | MB_ICONSTOP | (IDOK << 21)); ExitProcess(2); } #ifdef NSIS_SUPPORT_REBOOT if (g_exec_flags.reboot_called) { BOOL (WINAPI *OPT)(HANDLE, DWORD,PHANDLE); BOOL (WINAPI *LPV)(LPCTSTR,LPCTSTR,PLUID); BOOL (WINAPI *ATP)(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD); OPT=myGetProcAddress(MGA_OpenProcessToken); LPV=myGetProcAddress(MGA_LookupPrivilegeValue); ATP=myGetProcAddress(MGA_AdjustTokenPrivileges); if (OPT && LPV && ATP) { HANDLE hToken; TOKEN_PRIVILEGES tkp; if (OPT(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) { LPV(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); tkp.PrivilegeCount = 1; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; ATP(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); } } if (!ExitWindowsEx(EWX_REBOOT,0)) ExecuteCallbackFunction(CB_ONREBOOTFAILED); } #endif//NSIS_SUPPORT_REBOOT if (g_exec_flags.errlvl != -1) ret = g_exec_flags.errlvl; ExitProcess(ret); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow) { int ret = 0; const char *m_Err = _LANG_ERRORWRITINGTEMP; int cl_flags = 0; char *realcmds; char seekchar=' '; char *cmdline; InitCommonControls(); #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) { extern HRESULT g_hres; g_hres=OleInitialize(NULL); } #endif mystrcpy(g_caption,_LANG_GENERIC_ERROR); GetTempPath(NSIS_MAX_STRLEN, state_temp_dir); if (!ValidateTempDir()) { GetWindowsDirectory(state_temp_dir, NSIS_MAX_STRLEN - 5); // leave space for \Temp lstrcat(state_temp_dir, "\\Temp"); if (!ValidateTempDir()) { goto end; } } DeleteFile(state_command_line); lstrcpyn(state_command_line, GetCommandLine(), NSIS_MAX_STRLEN); #ifdef NSIS_CONFIG_VISIBLE_SUPPORT g_hInstance = GetModuleHandle(NULL); #endif//NSIS_CONFIG_VISIBLE_SUPPORT cmdline = state_command_line; if (*cmdline == '\"') seekchar = *cmdline++; cmdline=findchar(cmdline, seekchar); cmdline=CharNext(cmdline); realcmds=cmdline; while (*cmdline) { // skip over any spaces while (*cmdline == ' ') cmdline++; // get char we should look for to get the next parm seekchar = ' '; if (cmdline[0] == '\"') { cmdline++; seekchar = '\"'; } // is it a switch? if (cmdline[0] == '/') { cmdline++; // this only works with spaces because they have just one bit on #define END_OF_ARG(c) (((c)|' ')==' ') #if defined(NSIS_CONFIG_VISIBLE_SUPPORT) && defined(NSIS_CONFIG_SILENT_SUPPORT) if (cmdline[0] == 'S' && END_OF_ARG(cmdline[1])) cl_flags |= FH_FLAGS_SILENT; #endif//NSIS_CONFIG_SILENT_SUPPORT && NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_CRC_SUPPORT if (*(LPDWORD)cmdline == CHAR4_TO_DWORD('N','C','R','C') && END_OF_ARG(cmdline[4])) cl_flags |= FH_FLAGS_NO_CRC; #endif//NSIS_CONFIG_CRC_SUPPORT if (*(LPDWORD)(cmdline-2) == CHAR4_TO_DWORD(' ', '/', 'D','=')) { cmdline[-2]=0; // keep this from being passed to uninstaller if necessary mystrcpy(state_install_directory,cmdline+2); break; // /D= must always be last } } // skip over our parm cmdline = findchar(cmdline, seekchar); // skip the quote if (*cmdline == '\"') cmdline++; } m_Err = loadHeaders(cl_flags); if (m_Err) goto end; #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT if (g_is_uninstaller) { char *p = findchar(realcmds, 0); // state_command_line has state_install_directory right after it in memory, so reading // a bit over state_command_line won't do any harm while (p >= realcmds && *(LPDWORD)p != CHAR4_TO_DWORD(' ', '_', '?', '=')) p--; m_Err = _LANG_UNINSTINITERROR; if (p >= realcmds) { *p=0; // terminate before "_?=" p+=4; // skip over " _?=" if (is_valid_instpath(p)) { mystrcpy(state_install_directory, p); mystrcpy(state_output_directory, p); m_Err = 0; } else { goto end; } } else { int x; for (x = 0; x < 26; x ++) { static char s[]="A~NSISu_.exe"; static char buf2[NSIS_MAX_STRLEN*2]; static char ibuf[NSIS_MAX_STRLEN]; buf2[0]='\"'; mystrcpy(buf2+1,state_temp_dir); lstrcat(buf2,s); DeleteFile(buf2+1); // clean up after all the other ones if they are there if (m_Err) // not done yet { // get current name int l=GetModuleFileName(g_hInstance,ibuf,sizeof(ibuf)); // check if it is ?~NSISu_.exe - if so, f**k it if (!lstrcmpi(ibuf+l-(sizeof(s)-2),s+1)) break; // copy file if (CopyFile(ibuf,buf2+1,FALSE)) { HANDLE hProc; #ifdef NSIS_SUPPORT_MOVEONREBOOT MoveFileOnReboot(buf2+1,NULL); #endif if (state_install_directory[0]) mystrcpy(ibuf,state_install_directory); else trimslashtoend(ibuf); lstrcat(buf2,"\" "); lstrcat(buf2,realcmds); lstrcat(buf2," _?="); lstrcat(buf2,ibuf); // add a trailing backslash to make sure is_valid_instpath will not fail when it shouldn't addtrailingslash(buf2); hProc=myCreateProcess(buf2,state_temp_dir); if (hProc) { CloseHandle(hProc); // success m_Err = 0; } } } s[0]++; } goto end; } } #endif//NSIS_CONFIG_UNINSTALL_SUPPORT g_exec_flags.errlvl = -1; ret = ui_doinstall(); #ifdef NSIS_CONFIG_LOG #ifndef NSIS_CONFIG_LOG_ODS log_write(1); #endif//!NSIS_CONFIG_LOG_ODS #endif//NSIS_CONFIG_LOG end: CleanUp(); #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) OleUninitialize(); #endif if (m_Err) { my_MessageBox(m_Err, MB_OK | MB_ICONSTOP | (IDOK << 20)); ExitProcess(2); return 0; } #ifdef NSIS_SUPPORT_REBOOT if (g_exec_flags.reboot_called) { HANDLE h=GetModuleHandle("ADVAPI32.dll"); if (h) { BOOL (WINAPI *OPT)(HANDLE, DWORD,PHANDLE); BOOL (WINAPI *LPV)(LPCTSTR,LPCTSTR,PLUID); BOOL (WINAPI *ATP)(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD); OPT=(void*)GetProcAddress(h,"OpenProcessToken"); LPV=(void*)GetProcAddress(h,"LookupPrivilegeValueA"); ATP=(void*)GetProcAddress(h,"AdjustTokenPrivileges"); if (OPT && LPV && ATP) { HANDLE hToken; TOKEN_PRIVILEGES tkp; if (OPT(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) { LPV(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); tkp.PrivilegeCount = 1; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; ATP(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); } } } if (!ExitWindowsEx(EWX_REBOOT,0)) ExecuteCallbackFunction(CB_ONREBOOTFAILED); } #endif//NSIS_SUPPORT_REBOOT if (g_exec_flags.errlvl != -1) ret = g_exec_flags.errlvl; ExitProcess(ret); return 0; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow) { static int ret; static const char *m_Err; #ifdef NSIS_CONFIG_CRC_SUPPORT #ifdef NSIS_CONFIG_VISIBLE_SUPPORT static HWND hwnd; #endif static int crc; static char no_crc; static char do_crc; #endif//NSIS_CONFIG_CRC_SUPPORT #if defined(NSIS_CONFIG_SILENT_SUPPORT) && defined(NSIS_CONFIG_VISIBLE_SUPPORT) static char silent; #endif//NSIS_CONFIG_SILENT_SUPPORT && NSIS_CONFIG_VISIBLE_SUPPORT int left; #ifdef NSIS_CONFIG_VISIBLE_SUPPORT unsigned int verify_time=GetTickCount()+1000; #endif char *cmdline=state_command_line; char *realcmds; char seekchar=' '; InitCommonControls(); lstrcpyn(state_command_line,GetCommandLine(),NSIS_MAX_STRLEN); if (*cmdline == '\"') seekchar = *cmdline++; while (*cmdline && *cmdline != seekchar) if (*cmdline) cmdline++; if (*cmdline) cmdline++; realcmds=cmdline; do { #ifdef NSIS_CONFIG_CRC_SUPPORT #endif//NSIS_CONFIG_CRC_SUPPORT while (*cmdline == ' ') if (*cmdline) cmdline++; if (cmdline[0] != '/') break; cmdline++; #if defined(NSIS_CONFIG_VISIBLE_SUPPORT) && defined(NSIS_CONFIG_SILENT_SUPPORT) if (cmdline[0] == 'S' && (cmdline[1] == ' ' || !cmdline[1])) { silent++; cmdline+=2; } else #endif//NSIS_CONFIG_SILENT_SUPPORT && NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_CRC_SUPPORT if (cmdline[0] == 'N' && cmdline[1] == 'C' && cmdline[2] == 'R' && cmdline[3] == 'C' && (cmdline[4] == ' ' || !cmdline[4])) { no_crc++; cmdline+=4; } else #endif//NSIS_CONFIG_CRC_SUPPORT if (cmdline[0] == 'D' && cmdline[1] == '=') { cmdline[-2]=0; // keep this from being passed to uninstaller if necessary lstrcpy(state_install_directory,cmdline+2); cmdline+=lstrlen(cmdline); } else while (*cmdline && *cmdline != ' ') if (*cmdline) cmdline++; } while (*cmdline); lstrcpy(g_caption,_LANG_GENERIC_ERROR); g_hInstance=GetModuleHandle(NULL); GetModuleFileName(g_hInstance,state_exe_directory,NSIS_MAX_STRLEN); g_db_hFile=myOpenFile(state_exe_directory,GENERIC_READ,OPEN_EXISTING); if (g_db_hFile==INVALID_HANDLE_VALUE) { m_Err = _LANG_CANTOPENSELF; goto end; } // make state_exe_directory point to dir, not full exe. trimslashtoend(state_exe_directory); left = m_length = GetFileSize(g_db_hFile,NULL); while (left > 0) { static char temp[512]; DWORD l=left; if (l > 512) l=512; if (!ReadFile(g_db_hFile,temp,l,&l,NULL)) { m_Err=g_crcinvalid; #if defined(NSIS_CONFIG_CRC_SUPPORT) && defined(NSIS_CONFIG_VISIBLE_SUPPORT) if (hwnd) DestroyWindow(hwnd); #endif//NSIS_CONFIG_CRC_SUPPORT goto end; } if (!g_filehdrsize) { int dbl; dbl=isheader((firstheader*)temp); if (dbl) { int a=*(int*)temp; g_filehdrsize=m_pos; if (dbl > left) { m_Err=g_crcinvalid; goto end; } #if defined(NSIS_CONFIG_SILENT_SUPPORT) && defined(NSIS_CONFIG_VISIBLE_SUPPORT) if (a&FH_FLAGS_SILENT) silent++; #endif//NSIS_CONFIG_SILENT_SUPPORT && NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_CRC_SUPPORT // Changed by Amir Szekely 23rd July 2002 (CRCCheck force) if ((no_crc && !(a&FH_FLAGS_FORCE_CRC)) || !(a&FH_FLAGS_CRC)) break; // if first bit is not set, then no crc checking. do_crc++; #ifndef NSIS_CONFIG_CRC_ANAL left=dbl-4; // end crc checking at crc :) this means you can tack shit on the end and it'll still work. #else //!NSIS_CONFIG_CRC_ANAL left-=4; #endif//NSIS_CONFIG_CRC_ANAL // this is in case the end part is < 512 bytes. if (l > (DWORD)left) l=(DWORD)left; #else//!NSIS_CONFIG_CRC_SUPPORT break; #endif//!NSIS_CONFIG_CRC_SUPPORT } } #ifdef NSIS_CONFIG_CRC_SUPPORT #ifdef NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_SILENT_SUPPORT else if (!silent) #endif//NSIS_CONFIG_SILENT_SUPPORT { if (hwnd) { static MSG msg; while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) DispatchMessage(&msg); } else if (GetTickCount() > verify_time) hwnd=CreateDialog(g_hInstance,MAKEINTRESOURCE(IDD_VERIFY),GetDesktopWindow(),verProc); } #endif//NSIS_CONFIG_VISIBLE_SUPPORT #ifndef NSIS_CONFIG_CRC_ANAL if (left<m_length) #endif//NSIS_CONFIG_CRC_ANAL crc=CRC32(crc, temp, l); #endif//NSIS_CONFIG_CRC_SUPPORT m_pos+=l; left -= l; } #ifdef NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_CRC_SUPPORT if (hwnd) DestroyWindow(hwnd); #endif//NSIS_CONFIG_CRC_SUPPORT #endif//NSIS_CONFIG_VISIBLE_SUPPORT if (!g_filehdrsize) m_Err=g_crcinvalid; else { #ifdef NSIS_CONFIG_CRC_SUPPORT if (do_crc) { DWORD l; int fcrc; SetFilePointer(g_db_hFile,m_pos,NULL,FILE_BEGIN); if (!ReadFile(g_db_hFile,&fcrc,4,&l,NULL) || crc != fcrc) { m_Err=g_crcinvalid; goto end; } } #endif//NSIS_CONFIG_CRC_SUPPORT SetFilePointer(g_db_hFile,g_filehdrsize,NULL,FILE_BEGIN); if (loadHeaders()) m_Err=g_crcinvalid; } if (m_Err) goto end; #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT if (g_is_uninstaller) { if (cmdline[0] == '_' && cmdline[1] == '=' && cmdline[2]) { cmdline[-1]=0; cmdline+=2; if (is_valid_instpath(cmdline)) { lstrcpy(state_install_directory,cmdline); lstrcpy(state_output_directory,cmdline); } else { m_Err = g_errorcopyinginstall; goto end; } } else { int x,done=0; for (x = 0; x < 26; x ++) { static char s[]="A~NSISu_.exe"; static char buf2[NSIS_MAX_STRLEN*2]; static char ibuf[NSIS_MAX_STRLEN]; buf2[0]='\"'; GetTempPath(sizeof(buf2)-1,buf2+1); lstrcat(buf2,s); DeleteFile(buf2+1); // clean up after all the other ones if they are there if (!done) { // get current name int l=GetModuleFileName(g_hInstance,ibuf,sizeof(ibuf)); // check if it is ?~NSISu_.exe - if so, f**k it if (!lstrcmpi(ibuf+l-(sizeof(s)-2),s+1)) break; // copy file if (CopyFile(ibuf,buf2+1,FALSE)) { HANDLE hProc; #ifdef NSIS_SUPPORT_MOVEONREBOOT MoveFileOnReboot(buf2+1,NULL); #endif if (state_install_directory[0]) lstrcpy(ibuf,state_install_directory); else trimslashtoend(ibuf); if (!is_valid_instpath(ibuf)) break; done++; lstrcat(buf2,"\" "); lstrcat(buf2,realcmds); lstrcat(buf2," _="); lstrcat(buf2,ibuf); GetTempPath(sizeof(ibuf),ibuf); hProc=myCreateProcess(buf2,ibuf); if (hProc) CloseHandle(hProc); else m_Err = g_errorcopyinginstall; } } s[0]++; } if (!done) m_Err=g_errorcopyinginstall; goto end; } } #endif//NSIS_CONFIG_UNINSTALL_SUPPORT #ifdef NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_SILENT_SUPPORT if (!g_inst_cmnheader->silent_install) g_inst_cmnheader->silent_install=silent; #endif//NSIS_CONFIG_SILENT_SUPPORT #endif//NSIS_CONFIG_VISIBLE_SUPPORT ret=ui_doinstall(); #ifdef NSIS_CONFIG_LOG log_write(1); #endif//NSIS_CONFIG_LOG end: if (g_db_hFile!=INVALID_HANDLE_VALUE) CloseHandle(g_db_hFile); #ifdef NSIS_COMPRESS_WHOLE if (dbd_hFile!=INVALID_HANDLE_VALUE) CloseHandle(dbd_hFile); #endif if (m_Err) MessageBox(NULL,m_Err,g_caption,MB_OK|MB_ICONSTOP); ExitProcess(ret); }