replaced tabs with spaces
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3470 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
2027f3c76d
commit
77022dde8b
1 changed files with 163 additions and 163 deletions
|
@ -87,28 +87,28 @@ static void doRMDir(char *buf)
|
||||||
|
|
||||||
static void doMKDir(char *directory)
|
static void doMKDir(char *directory)
|
||||||
{
|
{
|
||||||
char *p, *p2;
|
char *p, *p2;
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
if (!*directory) return;
|
if (!*directory) return;
|
||||||
lstrcpy(buf,directory);
|
lstrcpy(buf,directory);
|
||||||
p=buf; while (*p) p++;
|
p=buf; while (*p) p++;
|
||||||
while (p >= buf && *p != '\\') p--;
|
while (p >= buf && *p != '\\') p--;
|
||||||
p2 = buf;
|
p2 = buf;
|
||||||
if (p2[1] == ':') p2+=4;
|
if (p2[1] == ':') p2+=4;
|
||||||
else if (p2[0] == '\\' && p2[1] == '\\')
|
else if (p2[0] == '\\' && p2[1] == '\\')
|
||||||
{
|
{
|
||||||
p2+=2;
|
p2+=2;
|
||||||
while (*p2 && *p2 != '\\') p2++;
|
while (*p2 && *p2 != '\\') p2++;
|
||||||
if (*p2) p2++;
|
if (*p2) p2++;
|
||||||
while (*p2 && *p2 != '\\') p2++;
|
while (*p2 && *p2 != '\\') p2++;
|
||||||
if (*p2) p2++;
|
if (*p2) p2++;
|
||||||
}
|
}
|
||||||
if (p >= p2)
|
if (p >= p2)
|
||||||
{
|
{
|
||||||
*p=0;
|
*p=0;
|
||||||
doMKDir(buf);
|
doMKDir(buf);
|
||||||
}
|
}
|
||||||
CreateDirectory(directory,NULL);
|
CreateDirectory(directory,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,9 +162,9 @@ int tempzip_make(HWND hwndDlg, char *fn)
|
||||||
|
|
||||||
int nf=0, nkb=0;
|
int nf=0, nkb=0;
|
||||||
g_extracting=1;
|
g_extracting=1;
|
||||||
do {
|
do {
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
unzGetCurrentFileInfo(f,NULL,filename,sizeof(filename),NULL,0,NULL,0);
|
unzGetCurrentFileInfo(f,NULL,filename,sizeof(filename),NULL,0,NULL,0);
|
||||||
if (filename[0] &&
|
if (filename[0] &&
|
||||||
filename[strlen(filename)-1] != '\\' &&
|
filename[strlen(filename)-1] != '\\' &&
|
||||||
filename[strlen(filename)-1] != '/')
|
filename[strlen(filename)-1] != '/')
|
||||||
|
@ -193,19 +193,19 @@ int tempzip_make(HWND hwndDlg, char *fn)
|
||||||
if (buf[0]) doMKDir(buf);
|
if (buf[0]) doMKDir(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unzOpenCurrentFile(f) == UNZ_OK)
|
if (unzOpenCurrentFile(f) == UNZ_OK)
|
||||||
{
|
{
|
||||||
SendDlgItemMessage(hwndDlg,IDC_ZIPINFO_FILES,LB_ADDSTRING,0,(LPARAM)pfn);
|
SendDlgItemMessage(hwndDlg,IDC_ZIPINFO_FILES,LB_ADDSTRING,0,(LPARAM)pfn);
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int l;
|
int l;
|
||||||
fp = fopen(out_filename,"wb");
|
fp = fopen(out_filename,"wb");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
l=unzReadCurrentFile(f,buf,sizeof(buf));
|
l=unzReadCurrentFile(f,buf,sizeof(buf));
|
||||||
if (l > 0)
|
if (l > 0)
|
||||||
{
|
{
|
||||||
if (fwrite(buf,1,l,fp) != (unsigned int)l)
|
if (fwrite(buf,1,l,fp) != (unsigned int)l)
|
||||||
{
|
{
|
||||||
|
@ -217,10 +217,10 @@ int tempzip_make(HWND hwndDlg, char *fn)
|
||||||
}
|
}
|
||||||
nkb++;
|
nkb++;
|
||||||
}
|
}
|
||||||
} while (l > 0);
|
} while (l > 0);
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unzClose(f);
|
unzClose(f);
|
||||||
|
@ -243,9 +243,9 @@ int tempzip_make(HWND hwndDlg, char *fn)
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
unzCloseCurrentFile(f);
|
unzCloseCurrentFile(f);
|
||||||
if (quit) break;
|
if (quit) break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unzClose(f);
|
unzClose(f);
|
||||||
|
@ -274,9 +274,9 @@ char *gp_poi = "(PATH OF INSTALLER)";
|
||||||
void wnd_printf(const char *str)
|
void wnd_printf(const char *str)
|
||||||
{
|
{
|
||||||
if (!*str) return;
|
if (!*str) return;
|
||||||
char existing_text[32000];
|
char existing_text[32000];
|
||||||
existing_text[0]=0;
|
existing_text[0]=0;
|
||||||
UINT l=GetDlgItemText(g_hwnd, IDC_OUTPUTTEXT, existing_text, 32000);
|
UINT l=GetDlgItemText(g_hwnd, IDC_OUTPUTTEXT, existing_text, 32000);
|
||||||
l+=strlen(str);
|
l+=strlen(str);
|
||||||
|
|
||||||
char *p=existing_text;
|
char *p=existing_text;
|
||||||
|
@ -300,32 +300,32 @@ void wnd_printf(const char *str)
|
||||||
lstrcpy(existing_text,buf);
|
lstrcpy(existing_text,buf);
|
||||||
lstrcat(existing_text,str);
|
lstrcat(existing_text,str);
|
||||||
|
|
||||||
SetDlgItemText(g_hwnd, IDC_OUTPUTTEXT, existing_text);
|
SetDlgItemText(g_hwnd, IDC_OUTPUTTEXT, existing_text);
|
||||||
SendDlgItemMessage(g_hwnd, IDC_OUTPUTTEXT, EM_LINESCROLL, 0, SendDlgItemMessage(g_hwnd, IDC_OUTPUTTEXT, EM_GETLINECOUNT, 0, 0)); // scroll to the last line of the textbox
|
SendDlgItemMessage(g_hwnd, IDC_OUTPUTTEXT, EM_LINESCROLL, 0, SendDlgItemMessage(g_hwnd, IDC_OUTPUTTEXT, EM_GETLINECOUNT, 0, 0)); // scroll to the last line of the textbox
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorMessage(char *str) //display detailed error info
|
void ErrorMessage(char *str) //display detailed error info
|
||||||
{
|
{
|
||||||
LPVOID msg;
|
LPVOID msg;
|
||||||
FormatMessage(
|
FormatMessage(
|
||||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
NULL,
|
NULL,
|
||||||
GetLastError(),
|
GetLastError(),
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||||
(LPTSTR) &msg,
|
(LPTSTR) &msg,
|
||||||
0,
|
0,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
wnd_printf(str);
|
wnd_printf(str);
|
||||||
wnd_printf(": ");
|
wnd_printf(": ");
|
||||||
wnd_printf((char*)msg);
|
wnd_printf((char*)msg);
|
||||||
LocalFree(msg);
|
LocalFree(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI ThreadProc(LPVOID p) // thread that will start & monitor wwwinamp
|
DWORD WINAPI ThreadProc(LPVOID p) // thread that will start & monitor wwwinamp
|
||||||
{
|
{
|
||||||
char buf[1024]; //i/o buffer
|
char buf[1024]; //i/o buffer
|
||||||
STARTUPINFO si={sizeof(si),};
|
STARTUPINFO si={sizeof(si),};
|
||||||
SECURITY_ATTRIBUTES sa={sizeof(sa),};
|
SECURITY_ATTRIBUTES sa={sizeof(sa),};
|
||||||
SECURITY_DESCRIPTOR sd={0,}; //security information for pipes
|
SECURITY_DESCRIPTOR sd={0,}; //security information for pipes
|
||||||
|
@ -333,87 +333,87 @@ DWORD WINAPI ThreadProc(LPVOID p) // thread that will start & monitor wwwinamp
|
||||||
HANDLE newstdout=0,read_stdout=0; //pipe handles
|
HANDLE newstdout=0,read_stdout=0; //pipe handles
|
||||||
|
|
||||||
OSVERSIONINFO osv={sizeof(osv)};
|
OSVERSIONINFO osv={sizeof(osv)};
|
||||||
GetVersionEx(&osv);
|
GetVersionEx(&osv);
|
||||||
if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) //initialize security descriptor (Windows NT)
|
if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) //initialize security descriptor (Windows NT)
|
||||||
{
|
{
|
||||||
InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION);
|
InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION);
|
||||||
SetSecurityDescriptorDacl(&sd, true, NULL, false);
|
SetSecurityDescriptorDacl(&sd, true, NULL, false);
|
||||||
sa.lpSecurityDescriptor = &sd;
|
sa.lpSecurityDescriptor = &sd;
|
||||||
}
|
}
|
||||||
else sa.lpSecurityDescriptor = NULL;
|
else sa.lpSecurityDescriptor = NULL;
|
||||||
sa.bInheritHandle = true; //allow inheritable handles
|
sa.bInheritHandle = true; //allow inheritable handles
|
||||||
|
|
||||||
if (!CreatePipe(&read_stdout,&newstdout,&sa,0)) //create stdout pipe
|
if (!CreatePipe(&read_stdout,&newstdout,&sa,0)) //create stdout pipe
|
||||||
{
|
{
|
||||||
ErrorMessage("CreatePipe");
|
ErrorMessage("CreatePipe");
|
||||||
PostMessage(g_hwnd,WM_USER+1203,0,1);
|
PostMessage(g_hwnd,WM_USER+1203,0,1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetStartupInfo(&si); //set startupinfo for the spawned process
|
GetStartupInfo(&si); //set startupinfo for the spawned process
|
||||||
/*
|
/*
|
||||||
The dwFlags member tells CreateProcess how to make the process.
|
The dwFlags member tells CreateProcess how to make the process.
|
||||||
STARTF_USESTDHANDLES validates the hStd* members. STARTF_USESHOWWINDOW
|
STARTF_USESTDHANDLES validates the hStd* members. STARTF_USESHOWWINDOW
|
||||||
validates the wShowWindow member.
|
validates the wShowWindow member.
|
||||||
*/
|
*/
|
||||||
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
|
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
|
||||||
si.wShowWindow = SW_HIDE;
|
si.wShowWindow = SW_HIDE;
|
||||||
si.hStdOutput = newstdout;
|
si.hStdOutput = newstdout;
|
||||||
si.hStdError = newstdout; //set the new handles for the child process
|
si.hStdError = newstdout; //set the new handles for the child process
|
||||||
|
|
||||||
// *******************************************************************
|
// *******************************************************************
|
||||||
// If there is a command line in the config file, use it for create process
|
// If there is a command line in the config file, use it for create process
|
||||||
|
|
||||||
//spawn the child process
|
//spawn the child process
|
||||||
if (!CreateProcess(NULL,g_cmdline,NULL,NULL,TRUE,CREATE_NEW_CONSOLE,
|
if (!CreateProcess(NULL,g_cmdline,NULL,NULL,TRUE,CREATE_NEW_CONSOLE,
|
||||||
NULL,tempzip_path,&si,&pi))
|
NULL,tempzip_path,&si,&pi))
|
||||||
{
|
{
|
||||||
ErrorMessage("CreateProcess");
|
ErrorMessage("CreateProcess");
|
||||||
wnd_printf("\r\nPlease make sure the path to makensis.exe is correct.");
|
wnd_printf("\r\nPlease make sure the path to makensis.exe is correct.");
|
||||||
CloseHandle(newstdout);
|
CloseHandle(newstdout);
|
||||||
CloseHandle(read_stdout);
|
CloseHandle(read_stdout);
|
||||||
PostMessage(g_hwnd,WM_USER+1203,0,1);
|
PostMessage(g_hwnd,WM_USER+1203,0,1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long exit=0; //process exit code
|
unsigned long exit=0; //process exit code
|
||||||
unsigned long bread; //bytes read
|
unsigned long bread; //bytes read
|
||||||
unsigned long avail; //bytes available
|
unsigned long avail; //bytes available
|
||||||
|
|
||||||
memset(buf,0,sizeof(buf));
|
memset(buf,0,sizeof(buf));
|
||||||
while (1) //main program loop
|
while (1) //main program loop
|
||||||
{
|
{
|
||||||
PeekNamedPipe(read_stdout,buf,1023,&bread,&avail,NULL);
|
PeekNamedPipe(read_stdout,buf,1023,&bread,&avail,NULL);
|
||||||
//check to see if there is any data to read from stdout
|
//check to see if there is any data to read from stdout
|
||||||
if (bread != 0)
|
if (bread != 0)
|
||||||
{
|
{
|
||||||
memset(buf,0,sizeof(buf));
|
memset(buf,0,sizeof(buf));
|
||||||
if (avail > 1023)
|
if (avail > 1023)
|
||||||
{
|
{
|
||||||
while (bread >= 1023)
|
while (bread >= 1023)
|
||||||
{
|
{
|
||||||
ReadFile(read_stdout,buf,1023,&bread,NULL); //read the stdout pipe
|
ReadFile(read_stdout,buf,1023,&bread,NULL); //read the stdout pipe
|
||||||
wnd_printf(buf);
|
wnd_printf(buf);
|
||||||
memset(buf,0,sizeof(buf));
|
memset(buf,0,sizeof(buf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ReadFile(read_stdout,buf,1023,&bread,NULL);
|
ReadFile(read_stdout,buf,1023,&bread,NULL);
|
||||||
wnd_printf(buf);
|
wnd_printf(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetExitCodeProcess(pi.hProcess,&exit); //while the process is running
|
GetExitCodeProcess(pi.hProcess,&exit); //while the process is running
|
||||||
if (exit != STILL_ACTIVE)
|
if (exit != STILL_ACTIVE)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
}
|
}
|
||||||
CloseHandle(pi.hThread);
|
CloseHandle(pi.hThread);
|
||||||
CloseHandle(pi.hProcess);
|
CloseHandle(pi.hProcess);
|
||||||
CloseHandle(newstdout);
|
CloseHandle(newstdout);
|
||||||
CloseHandle(read_stdout);
|
CloseHandle(read_stdout);
|
||||||
|
|
||||||
|
|
||||||
wsprintf(buf,"(source ZIP size was %d bytes)\r\n",g_zipfile_size);
|
wsprintf(buf,"(source ZIP size was %d bytes)\r\n",g_zipfile_size);
|
||||||
|
@ -463,7 +463,7 @@ void makeEXE(HWND hwndDlg)
|
||||||
if (!strcmp(buf,gp_winamp_plugins))
|
if (!strcmp(buf,gp_winamp_plugins))
|
||||||
{
|
{
|
||||||
iswinamp=1;
|
iswinamp=1;
|
||||||
fprintf(fp,"!define ZIP2EXE_INSTALLDIR_PLUGINS\n");
|
fprintf(fp,"!define ZIP2EXE_INSTALLDIR_PLUGINS\n");
|
||||||
}
|
}
|
||||||
if (!strcmp(buf,gp_winamp_vis))
|
if (!strcmp(buf,gp_winamp_vis))
|
||||||
{
|
{
|
||||||
|
@ -479,7 +479,7 @@ void makeEXE(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
iswinamp=1;
|
iswinamp=1;
|
||||||
iswinampmode="SkinDir";
|
iswinampmode="SkinDir";
|
||||||
fprintf(fp,"!define ZIP2EXE_INSTALLDIR_SKINS\n");
|
fprintf(fp,"!define ZIP2EXE_INSTALLDIR_SKINS\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iswinamp)
|
if (iswinamp)
|
||||||
|
@ -493,7 +493,7 @@ void makeEXE(HWND hwndDlg)
|
||||||
}
|
}
|
||||||
else // set out path to $INSTDIR
|
else // set out path to $INSTDIR
|
||||||
{
|
{
|
||||||
fprintf(fp,"!define ZIP2EXE_INSTALLDIR `%s`\n",buf);
|
fprintf(fp,"!define ZIP2EXE_INSTALLDIR `%s`\n",buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fp,"!include `${NSISDIR}\\Contrib\\zip2exe\\Base.nsh`\n");
|
fprintf(fp,"!include `${NSISDIR}\\Contrib\\zip2exe\\Base.nsh`\n");
|
||||||
|
@ -553,7 +553,7 @@ BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
g_hwnd=hwndDlg;
|
g_hwnd=hwndDlg;
|
||||||
CheckDlgButton(hwndDlg,IDC_LZMA,BST_CHECKED);
|
CheckDlgButton(hwndDlg,IDC_LZMA,BST_CHECKED);
|
||||||
CheckDlgButton(hwndDlg,IDC_MODERNUI,BST_CHECKED);
|
CheckDlgButton(hwndDlg,IDC_MODERNUI,BST_CHECKED);
|
||||||
SendDlgItemMessage(hwndDlg,IDC_INSTPATH,CB_ADDSTRING,0,(LPARAM)gp_poi);
|
SendDlgItemMessage(hwndDlg,IDC_INSTPATH,CB_ADDSTRING,0,(LPARAM)gp_poi);
|
||||||
SendDlgItemMessage(hwndDlg,IDC_INSTPATH,CB_ADDSTRING,0,(LPARAM)"$TEMP");
|
SendDlgItemMessage(hwndDlg,IDC_INSTPATH,CB_ADDSTRING,0,(LPARAM)"$TEMP");
|
||||||
SendDlgItemMessage(hwndDlg,IDC_INSTPATH,CB_ADDSTRING,0,(LPARAM)"$SYSDIR");
|
SendDlgItemMessage(hwndDlg,IDC_INSTPATH,CB_ADDSTRING,0,(LPARAM)"$SYSDIR");
|
||||||
|
@ -570,10 +570,10 @@ BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
SendDlgItemMessage(hwndDlg,IDC_INSTPATH,CB_ADDSTRING,0,(LPARAM)gp_winamp_dsp);
|
SendDlgItemMessage(hwndDlg,IDC_INSTPATH,CB_ADDSTRING,0,(LPARAM)gp_winamp_dsp);
|
||||||
SendDlgItemMessage(hwndDlg,IDC_INSTPATH,CB_ADDSTRING,0,(LPARAM)gp_winamp_skins);
|
SendDlgItemMessage(hwndDlg,IDC_INSTPATH,CB_ADDSTRING,0,(LPARAM)gp_winamp_skins);
|
||||||
|
|
||||||
SetDlgItemText(hwndDlg,IDC_INSTPATH,gp_poi);
|
SetDlgItemText(hwndDlg,IDC_INSTPATH,gp_poi);
|
||||||
|
|
||||||
hIcon=LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON1));
|
hIcon=LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON1));
|
||||||
SetClassLong(hwndDlg,GCL_HICON,(long)hIcon);
|
SetClassLong(hwndDlg,GCL_HICON,(long)hIcon);
|
||||||
|
|
||||||
hFont=CreateFont(15,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,
|
hFont=CreateFont(15,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,
|
||||||
OUT_CHARACTER_PRECIS,
|
OUT_CHARACTER_PRECIS,
|
||||||
|
@ -690,13 +690,13 @@ BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (!made)
|
if (!made)
|
||||||
{
|
{
|
||||||
if (IsDlgButtonChecked(hwndDlg,IDC_ZLIB))
|
if (IsDlgButtonChecked(hwndDlg,IDC_ZLIB))
|
||||||
g_compressor = 1;
|
g_compressor = 1;
|
||||||
if (IsDlgButtonChecked(hwndDlg,IDC_BZIP2))
|
if (IsDlgButtonChecked(hwndDlg,IDC_BZIP2))
|
||||||
g_compressor = 2;
|
g_compressor = 2;
|
||||||
if (IsDlgButtonChecked(hwndDlg,IDC_LZMA))
|
if (IsDlgButtonChecked(hwndDlg,IDC_LZMA))
|
||||||
g_compressor = 3;
|
g_compressor = 3;
|
||||||
g_mui=!IsDlgButtonChecked(hwndDlg,IDC_CLASSICUI);
|
g_mui=!IsDlgButtonChecked(hwndDlg,IDC_CLASSICUI);
|
||||||
SetDlgItemText(g_hwnd, IDC_OUTPUTTEXT, "");
|
SetDlgItemText(g_hwnd, IDC_OUTPUTTEXT, "");
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < sizeof(ids)/sizeof(ids[0]); x ++)
|
for (x = 0; x < sizeof(ids)/sizeof(ids[0]); x ++)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue