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)
|
||||
{
|
||||
char *p, *p2;
|
||||
char buf[MAX_PATH];
|
||||
char *p, *p2;
|
||||
char buf[MAX_PATH];
|
||||
if (!*directory) return;
|
||||
lstrcpy(buf,directory);
|
||||
lstrcpy(buf,directory);
|
||||
p=buf; while (*p) p++;
|
||||
while (p >= buf && *p != '\\') p--;
|
||||
p2 = buf;
|
||||
if (p2[1] == ':') p2+=4;
|
||||
else if (p2[0] == '\\' && p2[1] == '\\')
|
||||
{
|
||||
p2+=2;
|
||||
while (*p2 && *p2 != '\\') p2++;
|
||||
if (*p2) p2++;
|
||||
while (*p2 && *p2 != '\\') p2++;
|
||||
if (*p2) p2++;
|
||||
}
|
||||
if (p >= p2)
|
||||
{
|
||||
*p=0;
|
||||
doMKDir(buf);
|
||||
}
|
||||
CreateDirectory(directory,NULL);
|
||||
while (p >= buf && *p != '\\') p--;
|
||||
p2 = buf;
|
||||
if (p2[1] == ':') p2+=4;
|
||||
else if (p2[0] == '\\' && p2[1] == '\\')
|
||||
{
|
||||
p2+=2;
|
||||
while (*p2 && *p2 != '\\') p2++;
|
||||
if (*p2) p2++;
|
||||
while (*p2 && *p2 != '\\') p2++;
|
||||
if (*p2) p2++;
|
||||
}
|
||||
if (p >= p2)
|
||||
{
|
||||
*p=0;
|
||||
doMKDir(buf);
|
||||
}
|
||||
CreateDirectory(directory,NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,9 +162,9 @@ int tempzip_make(HWND hwndDlg, char *fn)
|
|||
|
||||
int nf=0, nkb=0;
|
||||
g_extracting=1;
|
||||
do {
|
||||
char filename[MAX_PATH];
|
||||
unzGetCurrentFileInfo(f,NULL,filename,sizeof(filename),NULL,0,NULL,0);
|
||||
do {
|
||||
char filename[MAX_PATH];
|
||||
unzGetCurrentFileInfo(f,NULL,filename,sizeof(filename),NULL,0,NULL,0);
|
||||
if (filename[0] &&
|
||||
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 (unzOpenCurrentFile(f) == UNZ_OK)
|
||||
{
|
||||
if (unzOpenCurrentFile(f) == UNZ_OK)
|
||||
{
|
||||
SendDlgItemMessage(hwndDlg,IDC_ZIPINFO_FILES,LB_ADDSTRING,0,(LPARAM)pfn);
|
||||
FILE *fp;
|
||||
int l;
|
||||
fp = fopen(out_filename,"wb");
|
||||
if (fp)
|
||||
{
|
||||
do
|
||||
{
|
||||
char buf[1024];
|
||||
l=unzReadCurrentFile(f,buf,sizeof(buf));
|
||||
if (l > 0)
|
||||
FILE *fp;
|
||||
int l;
|
||||
fp = fopen(out_filename,"wb");
|
||||
if (fp)
|
||||
{
|
||||
do
|
||||
{
|
||||
char buf[1024];
|
||||
l=unzReadCurrentFile(f,buf,sizeof(buf));
|
||||
if (l > 0)
|
||||
{
|
||||
if (fwrite(buf,1,l,fp) != (unsigned int)l)
|
||||
{
|
||||
|
@ -217,10 +217,10 @@ int tempzip_make(HWND hwndDlg, char *fn)
|
|||
}
|
||||
nkb++;
|
||||
}
|
||||
} while (l > 0);
|
||||
} while (l > 0);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
unzClose(f);
|
||||
|
@ -243,9 +243,9 @@ int tempzip_make(HWND hwndDlg, char *fn)
|
|||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
unzCloseCurrentFile(f);
|
||||
unzCloseCurrentFile(f);
|
||||
if (quit) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unzClose(f);
|
||||
|
@ -274,9 +274,9 @@ char *gp_poi = "(PATH OF INSTALLER)";
|
|||
void wnd_printf(const char *str)
|
||||
{
|
||||
if (!*str) return;
|
||||
char existing_text[32000];
|
||||
char existing_text[32000];
|
||||
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);
|
||||
|
||||
char *p=existing_text;
|
||||
|
@ -300,32 +300,32 @@ void wnd_printf(const char *str)
|
|||
lstrcpy(existing_text,buf);
|
||||
lstrcat(existing_text,str);
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
void ErrorMessage(char *str) //display detailed error info
|
||||
{
|
||||
LPVOID msg;
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
(LPTSTR) &msg,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
LPVOID msg;
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
(LPTSTR) &msg,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
wnd_printf(str);
|
||||
wnd_printf(": ");
|
||||
wnd_printf((char*)msg);
|
||||
LocalFree(msg);
|
||||
LocalFree(msg);
|
||||
}
|
||||
|
||||
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),};
|
||||
SECURITY_ATTRIBUTES sa={sizeof(sa),};
|
||||
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
|
||||
|
||||
OSVERSIONINFO osv={sizeof(osv)};
|
||||
GetVersionEx(&osv);
|
||||
if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) //initialize security descriptor (Windows NT)
|
||||
{
|
||||
InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION);
|
||||
SetSecurityDescriptorDacl(&sd, true, NULL, false);
|
||||
sa.lpSecurityDescriptor = &sd;
|
||||
}
|
||||
else sa.lpSecurityDescriptor = NULL;
|
||||
sa.bInheritHandle = true; //allow inheritable handles
|
||||
GetVersionEx(&osv);
|
||||
if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) //initialize security descriptor (Windows NT)
|
||||
{
|
||||
InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION);
|
||||
SetSecurityDescriptorDacl(&sd, true, NULL, false);
|
||||
sa.lpSecurityDescriptor = &sd;
|
||||
}
|
||||
else sa.lpSecurityDescriptor = NULL;
|
||||
sa.bInheritHandle = true; //allow inheritable handles
|
||||
|
||||
if (!CreatePipe(&read_stdout,&newstdout,&sa,0)) //create stdout pipe
|
||||
{
|
||||
ErrorMessage("CreatePipe");
|
||||
if (!CreatePipe(&read_stdout,&newstdout,&sa,0)) //create stdout pipe
|
||||
{
|
||||
ErrorMessage("CreatePipe");
|
||||
PostMessage(g_hwnd,WM_USER+1203,0,1);
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
GetStartupInfo(&si); //set startupinfo for the spawned process
|
||||
/*
|
||||
The dwFlags member tells CreateProcess how to make the process.
|
||||
STARTF_USESTDHANDLES validates the hStd* members. STARTF_USESHOWWINDOW
|
||||
validates the wShowWindow member.
|
||||
*/
|
||||
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
|
||||
si.wShowWindow = SW_HIDE;
|
||||
si.hStdOutput = newstdout;
|
||||
si.hStdError = newstdout; //set the new handles for the child process
|
||||
GetStartupInfo(&si); //set startupinfo for the spawned process
|
||||
/*
|
||||
The dwFlags member tells CreateProcess how to make the process.
|
||||
STARTF_USESTDHANDLES validates the hStd* members. STARTF_USESHOWWINDOW
|
||||
validates the wShowWindow member.
|
||||
*/
|
||||
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
|
||||
si.wShowWindow = SW_HIDE;
|
||||
si.hStdOutput = newstdout;
|
||||
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
|
||||
if (!CreateProcess(NULL,g_cmdline,NULL,NULL,TRUE,CREATE_NEW_CONSOLE,
|
||||
NULL,tempzip_path,&si,&pi))
|
||||
{
|
||||
ErrorMessage("CreateProcess");
|
||||
wnd_printf("\r\nPlease make sure the path to makensis.exe is correct.");
|
||||
CloseHandle(newstdout);
|
||||
CloseHandle(read_stdout);
|
||||
//spawn the child process
|
||||
if (!CreateProcess(NULL,g_cmdline,NULL,NULL,TRUE,CREATE_NEW_CONSOLE,
|
||||
NULL,tempzip_path,&si,&pi))
|
||||
{
|
||||
ErrorMessage("CreateProcess");
|
||||
wnd_printf("\r\nPlease make sure the path to makensis.exe is correct.");
|
||||
CloseHandle(newstdout);
|
||||
CloseHandle(read_stdout);
|
||||
PostMessage(g_hwnd,WM_USER+1203,0,1);
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned long exit=0; //process exit code
|
||||
unsigned long bread; //bytes read
|
||||
unsigned long avail; //bytes available
|
||||
unsigned long exit=0; //process exit code
|
||||
unsigned long bread; //bytes read
|
||||
unsigned long avail; //bytes available
|
||||
|
||||
memset(buf,0,sizeof(buf));
|
||||
while (1) //main program loop
|
||||
{
|
||||
PeekNamedPipe(read_stdout,buf,1023,&bread,&avail,NULL);
|
||||
//check to see if there is any data to read from stdout
|
||||
if (bread != 0)
|
||||
{
|
||||
while (1) //main program loop
|
||||
{
|
||||
PeekNamedPipe(read_stdout,buf,1023,&bread,&avail,NULL);
|
||||
//check to see if there is any data to read from stdout
|
||||
if (bread != 0)
|
||||
{
|
||||
memset(buf,0,sizeof(buf));
|
||||
if (avail > 1023)
|
||||
{
|
||||
while (bread >= 1023)
|
||||
{
|
||||
ReadFile(read_stdout,buf,1023,&bread,NULL); //read the stdout pipe
|
||||
wnd_printf(buf);
|
||||
if (avail > 1023)
|
||||
{
|
||||
while (bread >= 1023)
|
||||
{
|
||||
ReadFile(read_stdout,buf,1023,&bread,NULL); //read the stdout pipe
|
||||
wnd_printf(buf);
|
||||
memset(buf,0,sizeof(buf));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadFile(read_stdout,buf,1023,&bread,NULL);
|
||||
wnd_printf(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadFile(read_stdout,buf,1023,&bread,NULL);
|
||||
wnd_printf(buf);
|
||||
}
|
||||
}
|
||||
|
||||
GetExitCodeProcess(pi.hProcess,&exit); //while the process is running
|
||||
if (exit != STILL_ACTIVE)
|
||||
break;
|
||||
GetExitCodeProcess(pi.hProcess,&exit); //while the process is running
|
||||
if (exit != STILL_ACTIVE)
|
||||
break;
|
||||
|
||||
Sleep(100);
|
||||
}
|
||||
CloseHandle(pi.hThread);
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(newstdout);
|
||||
CloseHandle(read_stdout);
|
||||
Sleep(100);
|
||||
}
|
||||
CloseHandle(pi.hThread);
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(newstdout);
|
||||
CloseHandle(read_stdout);
|
||||
|
||||
|
||||
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))
|
||||
{
|
||||
iswinamp=1;
|
||||
fprintf(fp,"!define ZIP2EXE_INSTALLDIR_PLUGINS\n");
|
||||
fprintf(fp,"!define ZIP2EXE_INSTALLDIR_PLUGINS\n");
|
||||
}
|
||||
if (!strcmp(buf,gp_winamp_vis))
|
||||
{
|
||||
|
@ -479,7 +479,7 @@ void makeEXE(HWND hwndDlg)
|
|||
{
|
||||
iswinamp=1;
|
||||
iswinampmode="SkinDir";
|
||||
fprintf(fp,"!define ZIP2EXE_INSTALLDIR_SKINS\n");
|
||||
fprintf(fp,"!define ZIP2EXE_INSTALLDIR_SKINS\n");
|
||||
}
|
||||
|
||||
if (iswinamp)
|
||||
|
@ -493,7 +493,7 @@ void makeEXE(HWND hwndDlg)
|
|||
}
|
||||
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");
|
||||
|
@ -553,7 +553,7 @@ BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_INITDIALOG:
|
||||
g_hwnd=hwndDlg;
|
||||
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)"$TEMP");
|
||||
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_skins);
|
||||
|
||||
SetDlgItemText(hwndDlg,IDC_INSTPATH,gp_poi);
|
||||
SetDlgItemText(hwndDlg,IDC_INSTPATH,gp_poi);
|
||||
|
||||
hIcon=LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON1));
|
||||
SetClassLong(hwndDlg,GCL_HICON,(long)hIcon);
|
||||
hIcon=LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON1));
|
||||
SetClassLong(hwndDlg,GCL_HICON,(long)hIcon);
|
||||
|
||||
hFont=CreateFont(15,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,
|
||||
OUT_CHARACTER_PRECIS,
|
||||
|
@ -690,13 +690,13 @@ BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
if (!made)
|
||||
{
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_ZLIB))
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_ZLIB))
|
||||
g_compressor = 1;
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_BZIP2))
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_BZIP2))
|
||||
g_compressor = 2;
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_LZMA))
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_LZMA))
|
||||
g_compressor = 3;
|
||||
g_mui=!IsDlgButtonChecked(hwndDlg,IDC_CLASSICUI);
|
||||
g_mui=!IsDlgButtonChecked(hwndDlg,IDC_CLASSICUI);
|
||||
SetDlgItemText(g_hwnd, IDC_OUTPUTTEXT, "");
|
||||
int x;
|
||||
for (x = 0; x < sizeof(ids)/sizeof(ids[0]); x ++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue