This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@625 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9b3b220a13
commit
3e9e73ec59
177 changed files with 37677 additions and 0 deletions
364
Source/exehead/Main.c
Normal file
364
Source/exehead/Main.c
Normal file
|
@ -0,0 +1,364 @@
|
|||
/*
|
||||
Nullsoft "SuperPimp" Installation System - main.c - executable header main code
|
||||
|
||||
Copyright (C) 1999-2002 Nullsoft, Inc.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
This source distribution includes portions of zlib. see zlib/zlib.h for
|
||||
its license and so forth. Note that this license is also borrowed from zlib.
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "resource.h"
|
||||
#include "util.h"
|
||||
#include "fileform.h"
|
||||
#include "state.h"
|
||||
#include "ui.h"
|
||||
|
||||
#include "lang.h"
|
||||
|
||||
extern unsigned long CRC32(unsigned long crc, const unsigned char *buf, unsigned int len);
|
||||
|
||||
#if !defined(NSIS_CONFIG_VISIBLE_SUPPORT) && !defined(NSIS_CONFIG_SILENT_SUPPORT)
|
||||
#error One of NSIS_CONFIG_SILENT_SUPPORT or NSIS_CONFIG_VISIBLE_SUPPORT must be defined.
|
||||
#endif
|
||||
#ifdef NSIS_COMPRESS_WHOLE
|
||||
extern HANDLE dbd_hFile;
|
||||
#endif
|
||||
#ifdef NSIS_CONFIG_CRC_SUPPORT
|
||||
static const char *g_crcinvalid=_LANG_INVALIDCRC;
|
||||
#else
|
||||
static const char *g_crcinvalid=_LANG_INVALIDINST;
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
static const char *g_errorcopyinginstall=_LANG_UNINSTINITERROR;
|
||||
#endif
|
||||
|
||||
char g_caption[NSIS_MAX_STRLEN*2];
|
||||
int g_filehdrsize;
|
||||
HWND g_hwnd;
|
||||
|
||||
static int m_length;
|
||||
static int m_pos;
|
||||
|
||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
#ifdef NSIS_CONFIG_CRC_SUPPORT
|
||||
static BOOL CALLBACK verProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (uMsg == WM_INITDIALOG)
|
||||
{
|
||||
SetTimer(hwndDlg,1,250,NULL);
|
||||
uMsg = WM_TIMER;
|
||||
}
|
||||
if (uMsg == WM_TIMER)
|
||||
{
|
||||
static char bt[64];
|
||||
wsprintf(bt,_LANG_VERIFYINGINST,MulDiv(m_pos,100,m_length));
|
||||
|
||||
SetWindowText(hwndDlg,bt);
|
||||
SetDlgItemText(hwndDlg,IDC_STR,bt);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif//NSIS_CONFIG_CRC_SUPPORT
|
||||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
|
||||
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, fuck 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);
|
||||
}
|
||||
|
81
Source/exehead/Makefile
Normal file
81
Source/exehead/Makefile
Normal file
|
@ -0,0 +1,81 @@
|
|||
# -- Objects and source files --
|
||||
SRCS = bgbg.c exec.c fileform.c main.c ui.c util.c ../crc32.c ../zlib/infblock.c ../zlib/infcodes.c ../zlib/inflate.c ../zlib/inftrees.c ../zlib/infutil.c ../bzip2/bzlib.c ../bzip2/decompress.c ../bzip2/huffman.c ../bzip2/randtable.c
|
||||
OBJS = bgbg.o exec.o fileform.o main.o ui.o util.o resource.res crc32.o infblock.o infcodes.o inflate.o inftrees.o infutil.o bzlib.o decompress.o huffman.o randtable.o
|
||||
LIBS = -lole32 -lgdi32 -lversion -luuid -lcomctl32 -lkernel32 -luser32 -lshell32 -ladvapi32
|
||||
|
||||
# -- Programs --
|
||||
CC = gcc
|
||||
RC = windres
|
||||
RM = del
|
||||
|
||||
# -- Compilers and linker flags --
|
||||
DEFINES = -DWIN32 -D_WINDOWS_ -DEXEHEAD -DWinMain=WinMainCRTStartup
|
||||
CFLAGS = -Os -fomit-frame-pointer -fno-inline $(DEFINES)
|
||||
LFLAGS = -s -mwindows -nostdlib -nostartfiles -Wl,--enable-stdcall-fixup
|
||||
RCFLAGS = --input-format rc --output-format coff
|
||||
|
||||
all : exehead
|
||||
|
||||
exehead : $(OBJS)
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o exehead.exe $(OBJS) $(LIBS)
|
||||
bin2h exehead.exe Release\exehead.h header_data
|
||||
bin2h bitmap1.bmp Release\bitmap1.h bitmap1_data
|
||||
bin2h bitmap2.bmp Release\bitmap2.h bitmap2_data
|
||||
bin2h nsis.ico Release\icon.h icon_data
|
||||
bin2h uninst.ico Release\unicon.h unicon_data
|
||||
|
||||
# -- Dependencies --
|
||||
bgbg.o : bgbg.c resource.h config.h Makefile
|
||||
exec.o : exec.c fileform.h util.h state.h ui.h exec.h config.h lang.h Makefile
|
||||
fileform.o : fileform.c fileform.h util.h state.h ../zlib/zlib.h ../zlib/zconf.h ui.h config.h Makefile
|
||||
main.o : main.c resource.h util.h fileform.h state.h ui.h ../zlib/zlib.h ../zlib/zconf.h config.h lang.h Makefile
|
||||
ui.o : ui.c resource.h fileform.h state.h ui.h config.h Makefile
|
||||
util.o : util.c util.h state.h fileform.h ui.h config.h Makefile
|
||||
|
||||
# -- Special command line for the resource file --
|
||||
resource.res : resource.rc resource.h config.h Makefile
|
||||
$(RC) $(RCFLAGS) -o resource.res -i resource.rc
|
||||
|
||||
crc32.o : ../crc32.c config.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../crc32.c -o crc32.o
|
||||
|
||||
|
||||
# -- Special command lines for zlib --
|
||||
infblock.o : ../zlib/infblock.c ../zlib/zutil.h ../zlib/infblock.h ../zlib/inftrees.h ../zlib/infcodes.h ../zlib/infutil.h ../zlib/zlib.h ../zlib/zconf.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../zlib/infblock.c -o infblock.o
|
||||
|
||||
infcodes.o : ../zlib/infcodes.c ../zlib/zutil.h ../zlib/inftrees.h ../zlib/infblock.h ../zlib/infcodes.h ../zlib/infutil.h ../zlib/zlib.h ../zlib/zconf.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../zlib/infcodes.c -o infcodes.o
|
||||
|
||||
inflate.o : ../zlib/inflate.c ../zlib/zutil.h ../zlib/infblock.h ../zlib/zlib.h ../zlib/zconf.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../zlib/inflate.c -o inflate.o
|
||||
|
||||
inftrees.o : ../zlib/inftrees.c ../zlib/zutil.h ../zlib/inftrees.h ../zlib/zlib.h ../zlib/zconf.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../zlib/inftrees.c -o inftrees.o
|
||||
|
||||
infutil.o : ../zlib/infutil.c ../zlib/zutil.h ../zlib/infblock.h ../zlib/inftrees.h ../zlib/infcodes.h ../zlib/infutil.h ../zlib/zlib.h ../zlib/zconf.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../zlib/infutil.c -o infutil.o
|
||||
|
||||
# -- Special command lines for bzip2 --
|
||||
bzlib.o : ../bzip2/bzlib.c ../bzip2/bzlib.h ../bzip2/bzlib_private.h config.h
|
||||
$(CC) $(CFLAGS) -c ../bzip2/bzlib.c -o bzlib.o
|
||||
|
||||
decompress.o : ../bzip2/decompress.c ../bzip2/bzlib.h ../bzip2/bzlib_private.h config.h
|
||||
$(CC) $(CFLAGS) -c ../bzip2/decompress.c -o decompress.o
|
||||
|
||||
huffman.o : ../bzip2/huffman.c ../bzip2/bzlib.h ../bzip2/bzlib_private.h config.h
|
||||
$(CC) $(CFLAGS) -c ../bzip2/huffman.c -o huffman.o
|
||||
|
||||
randtable.o : ../bzip2/randtable.c ../bzip2/bzlib.h ../bzip2/bzlib_private.h config.h
|
||||
$(CC) $(CFLAGS) -c ../bzip2/randtable.c -o randtable.o
|
||||
|
||||
# -- Clean script --
|
||||
clean ::
|
||||
$(RM) *.o
|
||||
$(RM) resource.res
|
||||
$(RM) exehead.exe
|
||||
$(RM) Release\exehead.h
|
||||
$(RM) Release\bitmap1.h
|
||||
$(RM) Release\bitmap2.h
|
||||
$(RM) Release\icon.h
|
||||
$(RM) Release\unicon.h
|
1237
Source/exehead/Ui.c
Normal file
1237
Source/exehead/Ui.c
Normal file
File diff suppressed because it is too large
Load diff
5
Source/exehead/afxres.h
Normal file
5
Source/exehead/afxres.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include <windows.h>
|
||||
|
||||
#ifndef IDC_STATIC
|
||||
#define IDC_STATIC -1
|
||||
#endif
|
90
Source/exehead/bgbg.c
Normal file
90
Source/exehead/bgbg.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef NSIS_SUPPORT_BGBG
|
||||
|
||||
static int m_color1, m_color2, m_textcolor;
|
||||
|
||||
static LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
{
|
||||
static PAINTSTRUCT ps;
|
||||
HFONT newFont, oldFont;
|
||||
HDC hdc=BeginPaint(hwnd,&ps);
|
||||
RECT r;
|
||||
int y;
|
||||
GetClientRect(hwnd,&r);
|
||||
// this portion by Drew Davidson, drewdavidson@mindspring.com
|
||||
|
||||
// JF: made slower, reduced to 4 pixels high, because I like how it looks better/
|
||||
for (y = r.top; y < r.bottom; y += 4)
|
||||
{
|
||||
int rv,gv,bv;
|
||||
RECT rect;
|
||||
HBRUSH brush;
|
||||
rv = GetRValue(m_color2) * y / r.bottom + GetRValue(m_color1) * (r.bottom - y) / r.bottom;
|
||||
gv = GetGValue(m_color2) * y / r.bottom + GetGValue(m_color1) * (r.bottom - y) / r.bottom;
|
||||
bv = GetBValue(m_color2) * y / r.bottom + GetBValue(m_color1) * (r.bottom - y) / r.bottom;
|
||||
brush = CreateSolidBrush(RGB(rv,gv,bv));
|
||||
SetRect(&rect, r.left, y, r.right, y+4);
|
||||
// note that we don't need to do "SelectObject(hdc, brush)"
|
||||
// because FillRect lets us specify the brush as a parameter.
|
||||
FillRect(hdc, &rect, brush);
|
||||
DeleteObject(brush);
|
||||
}
|
||||
|
||||
if (m_textcolor != -1)
|
||||
{
|
||||
newFont = CreateFont(40,0,0,0,FW_BOLD,TRUE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"Garamond");
|
||||
if (newFont)
|
||||
{
|
||||
static char buf[256];
|
||||
r.left+=16;
|
||||
r.top+=8;
|
||||
GetWindowText(hwnd,buf,sizeof(buf));
|
||||
SetBkMode(hdc,TRANSPARENT);
|
||||
SetTextColor(hdc,m_textcolor);
|
||||
oldFont = SelectObject(hdc,newFont);
|
||||
DrawText(hdc,buf,-1,&r,DT_TOP|DT_LEFT|DT_SINGLELINE);
|
||||
SelectObject(hdc,oldFont);
|
||||
DeleteObject(newFont);
|
||||
}
|
||||
}
|
||||
EndPaint(hwnd,&ps);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProc(hwnd,uMsg,wParam,lParam);
|
||||
}
|
||||
|
||||
|
||||
HWND bgWnd_Init(HINSTANCE hInstance, char *title, int color1, int color2, int color3)
|
||||
{
|
||||
RECT vp;
|
||||
char classname[4]="_Nb";
|
||||
static WNDCLASS wc;
|
||||
wc.style = CS_VREDRAW | CS_HREDRAW;
|
||||
wc.lpfnWndProc = BG_WndProc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON2));
|
||||
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
wc.lpszClassName = classname;
|
||||
|
||||
if (!RegisterClass(&wc)) return 0;
|
||||
|
||||
m_color1=color1;
|
||||
m_color2=color2;
|
||||
m_textcolor=color3;
|
||||
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &vp, 0);
|
||||
|
||||
return CreateWindow(classname,title,WS_VISIBLE|WS_OVERLAPPED|WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX,
|
||||
vp.left,vp.top,vp.right-vp.left,vp.bottom-vp.top,GetDesktopWindow(),NULL,hInstance,NULL);
|
||||
}
|
||||
|
||||
|
||||
#endif //NSIS_SUPPORT_BGBG
|
60
Source/exehead/bin2h.c
Normal file
60
Source/exehead/bin2h.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* Generates a .h file from a binary file.
|
||||
** v1.2 - 3/8/01
|
||||
** Copyright (C) 1996-2001 Justin Frankel
|
||||
** Public domain.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int length;
|
||||
FILE *in, *out;
|
||||
char *outfilename;
|
||||
char *token;
|
||||
int total_bytes=0;
|
||||
|
||||
if (argc != 4) {
|
||||
fprintf(stderr,"Usage: bin2h file.dat outfile.h token_name\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
in = fopen(argv[1],"rb");
|
||||
|
||||
if (!in) {
|
||||
fprintf(stderr,"Error: file not found\n");
|
||||
return 1;
|
||||
}
|
||||
out = fopen(argv[2],"wt");
|
||||
|
||||
if (!out) {
|
||||
fclose(in);
|
||||
fprintf(stderr,"Error: could not open output file\n");
|
||||
return 1;
|
||||
}
|
||||
fseek(in,0,SEEK_END);
|
||||
length=ftell(in);
|
||||
fseek(in,0,SEEK_SET);
|
||||
|
||||
outfilename = argv[2];
|
||||
token = argv[3];
|
||||
fprintf(out,"unsigned char %s[%d] = { \n",token,length);
|
||||
for (;;) {
|
||||
static int firsttime;
|
||||
static int linecount;
|
||||
int c;
|
||||
if (++linecount > 10) {
|
||||
linecount = 0;
|
||||
fprintf(out,",\n ");
|
||||
}
|
||||
else if (firsttime) fprintf(out,", ");
|
||||
firsttime = 1;
|
||||
c = fgetc(in);
|
||||
if (feof(in)) break;
|
||||
total_bytes++;
|
||||
fprintf(out,"%i",c);
|
||||
}
|
||||
fprintf(out,"};\n",token);
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
fprintf(stderr,"%s -> %s (%d bytes)\n\n",argv[1],token,total_bytes);
|
||||
return 0;
|
||||
}
|
BIN
Source/exehead/bin2h.exe
Executable file
BIN
Source/exehead/bin2h.exe
Executable file
Binary file not shown.
BIN
Source/exehead/bitmap1.bmp
Normal file
BIN
Source/exehead/bitmap1.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 886 B |
260
Source/exehead/config.h
Normal file
260
Source/exehead/config.h
Normal file
|
@ -0,0 +1,260 @@
|
|||
#ifndef NSIS_CONFIG_H
|
||||
#define NSIS_CONFIG_H
|
||||
|
||||
#ifndef APSTUDIO_INVOKED // keep msdev's resource editor from mangling the .rc file
|
||||
|
||||
// NSIS_MAX_STRLEN defines the maximum string length for internal variables
|
||||
// and stack entries. 1024 should be plenty, but if you are doing crazy registry
|
||||
// shit, you might want to bump it up. Generally it adds about 16-32x the memory,
|
||||
// so setting this to 4096 from 1024 will add around 64k of memory usage (not
|
||||
// really a big deal, but not usually needed).
|
||||
#define NSIS_MAX_STRLEN 1024
|
||||
|
||||
|
||||
// NSIS_MAX_INST_TYPES specified the maximum install types.
|
||||
// note that this should not exceed 30, ever.
|
||||
#define NSIS_MAX_INST_TYPES 8
|
||||
|
||||
// NSIS_CONFIG_UNINSTALL_SUPPORT enables the uninstaller
|
||||
// support. Comment it out if your installers don't need
|
||||
// uninstallers
|
||||
// adds approximately 2kb.
|
||||
#define NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
|
||||
// NSIS_CONFIG_LICENSEPAGE enables support for the installer to
|
||||
// present a license page.
|
||||
#define NSIS_CONFIG_LICENSEPAGE
|
||||
|
||||
// NSIS_CONFIG_LICENSEPAGE enables support for the installer to
|
||||
// present a page.where you can select what sections are installed.
|
||||
// with this disabled, all sections are installed.
|
||||
#define NSIS_CONFIG_COMPONENTPAGE
|
||||
|
||||
// NSIS_CONFIG_SILENT_SUPPORT enables support for making installers
|
||||
// that are completely silent.
|
||||
#define NSIS_CONFIG_SILENT_SUPPORT
|
||||
|
||||
// NSIS_CONFIG_VISIBLE_SUPPORT enables support for making installers
|
||||
// that are visible.
|
||||
#define NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
|
||||
|
||||
// Changed by Amir Szekely 31st July 2002
|
||||
// Now supports runtime choice of compression method
|
||||
|
||||
// NSIS_CONFIG_COMPRESSION_SUPPORT enables support for making installers
|
||||
// that use compression (recommended).
|
||||
#define NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
// compression specific options
|
||||
|
||||
// NSIS_ZLIB_COMPRESS_WHOLE makes all install data in zlib installers
|
||||
// compressed together. Runtime requirements are increased, but potential
|
||||
// for compression is as well. Adds approximately 1kb of disk footprint,
|
||||
// and requires that the installer create a (potentially large) temporary
|
||||
// file in the temp directory.
|
||||
// #define NSIS_ZLIB_COMPRESS_WHOLE
|
||||
|
||||
// NSIS_BZIP2_COMPRESS_WHOLE makes all install data in bzip2 installers
|
||||
// compressed together. Runtime requirements are increased, but potential
|
||||
// for compression is as well. Adds approximately 1kb of disk footprint,
|
||||
// and requires that the installer create a (potentially large) temporary
|
||||
// file in the temp directory.
|
||||
#define NSIS_BZIP2_COMPRESS_WHOLE
|
||||
|
||||
// if NSIS_COMPRESS_BZIP2_SMALLMODE is defined, bzip2's decompressor uses
|
||||
// bzip2's alternative decompression method that uses a lot less memory, at
|
||||
// the expense of speed. not recommended.
|
||||
// #define NSIS_COMPRESS_BZIP2_SMALLMODE
|
||||
|
||||
// if NSIS_COMPRESS_BZIP2_LEVEL is defined, it overrides the default bzip2
|
||||
// compression window size of 9 (1-9 is valid)
|
||||
// 9 uses the most memory, but typically compresses best (recommended).
|
||||
// 1 uses the least memory, but typically compresses the worst.
|
||||
#define NSIS_COMPRESS_BZIP2_LEVEL 9
|
||||
|
||||
|
||||
// NSIS_CONFIG_CRC_SUPPORT enables support for installer verification.
|
||||
// HIGHLY recommended.
|
||||
#define NSIS_CONFIG_CRC_SUPPORT
|
||||
|
||||
// NSIS_CONFIG_CRC_ANAL makes the CRC verification extremely careful, meaning
|
||||
// extra bytes on the end of file, or the first 512 bytes changing, will give
|
||||
// error. Enable this if you are paranoid, otherwise leaving it off seems safe
|
||||
// (and is less prone to reporting virii). If you will be digitally signing your
|
||||
// installers, leave this off (the default).
|
||||
// #define NSIS_CONFIG_CRC_ANAL
|
||||
|
||||
|
||||
// NSIS_CONFIG_LOG enables the logging facility.
|
||||
// turning this on (by uncommenting it) adds about
|
||||
// 3kb, but can be useful in debugging your installers.
|
||||
// NOT ENABLED BY DEFAULT.
|
||||
// #define NSIS_CONFIG_LOG
|
||||
|
||||
// NSIS_SUPPORT_BGBG enables support for the blue (well, whatever
|
||||
// color you want) gradient background window.
|
||||
#define NSIS_SUPPORT_BGBG
|
||||
|
||||
|
||||
// NSIS_SUPPORT_CODECALLBACKS enables support for installer code callbacks.
|
||||
// recommended, as it uses a minimum of space and allows for neat functionality.
|
||||
#define NSIS_SUPPORT_CODECALLBACKS
|
||||
|
||||
|
||||
// NSIS_SUPPORT_MOVEONREBOOT enables support for uninstallers that automatically
|
||||
// delete themselves from the temp directory, as well as the reboot moving/deleting
|
||||
// modes of Delete and Rename. Adds about 512 gay bytes..
|
||||
#define NSIS_SUPPORT_MOVEONREBOOT
|
||||
|
||||
/////////////// the following are instruction enabling defines ///////////////
|
||||
|
||||
// NSIS_SUPPORT_ACTIVEXREG enables activeX plug-in registration
|
||||
// and deregistration, as well as CallInstDLL
|
||||
#define NSIS_SUPPORT_ACTIVEXREG
|
||||
|
||||
// NSIS_SUPPORT_INTOPTS enables support for IntCmp, IntCmpU, IntOp, and IntFmt.
|
||||
#define NSIS_SUPPORT_INTOPTS
|
||||
|
||||
// NSIS_SUPPORT_STROPTS enables support for StrCmp, StrCpy, and StrLen, as well as Get*Local.
|
||||
#define NSIS_SUPPORT_STROPTS
|
||||
|
||||
// NSIS_SUPPORT_STACK enables support for the stack (Push, Pop, Exch)
|
||||
#define NSIS_SUPPORT_STACK
|
||||
|
||||
// NSIS_SUPPORT_FILEFUNCTIONS enables support for FileOpen,FileClose, FileSeek, FileRead, and FileWrite.
|
||||
#define NSIS_SUPPORT_FILEFUNCTIONS
|
||||
|
||||
// NSIS_SUPPORT_FINDFIRST enables support for FindFirst, FindNext, and FindClose.
|
||||
#define NSIS_SUPPORT_FINDFIRST
|
||||
|
||||
// NSIS_SUPPORT_CREATESHORTCUT enables support for CreateShortCut.
|
||||
#define NSIS_SUPPORT_CREATESHORTCUT
|
||||
|
||||
// NSIS_SUPPORT_INIFILES enables support for ReadINIStr and WriteINIStr.
|
||||
#define NSIS_SUPPORT_INIFILES
|
||||
|
||||
// NSIS_SUPPORT_REGISTRYFUNCTIONS enables support for ReadRegStr, ReadRegDWORD, WriteRegStr, etc etc etc.
|
||||
#define NSIS_SUPPORT_REGISTRYFUNCTIONS
|
||||
|
||||
// NSIS_SUPPORT_COPYFILES enables support for CopyFiles
|
||||
#define NSIS_SUPPORT_COPYFILES
|
||||
|
||||
// NSIS_SUPPORT_REBOOT enables support for Reboot, IfRebootFlag, SetRebootFlag
|
||||
#define NSIS_SUPPORT_REBOOT
|
||||
|
||||
// NSIS_SUPPORT_FNUTIL enables support for GetFullPathName, GetTempFileName, and SearchPath
|
||||
#define NSIS_SUPPORT_FNUTIL
|
||||
|
||||
// NSIS_SUPPORT_EXECUTE enables support for Exec and ExecWait
|
||||
#define NSIS_SUPPORT_EXECUTE
|
||||
|
||||
// NSIS_SUPPORT_SHELLEXECUTE enables support for ExecShell
|
||||
#define NSIS_SUPPORT_SHELLEXECUTE
|
||||
|
||||
// NSIS_SUPPORT_GETDLLVERSION enables support for GetDLLVersion
|
||||
#define NSIS_SUPPORT_GETDLLVERSION
|
||||
|
||||
// NSIS_SUPPORT_GETFILETIME enables support for GetFileTime
|
||||
#define NSIS_SUPPORT_GETFILETIME
|
||||
|
||||
// NSIS_SUPPORT_HWNDS enables support for FindWindow, SendMessage, and IsWindow
|
||||
#define NSIS_SUPPORT_HWNDS
|
||||
|
||||
// NSIS_SUPPORT_ENVIRONMENT enables support for ReadEnvStr and ExpandEnvStrings
|
||||
#define NSIS_SUPPORT_ENVIRONMENT
|
||||
|
||||
// NSIS_SUPPORT_RMDIR enables support for RMDir
|
||||
#define NSIS_SUPPORT_RMDIR
|
||||
|
||||
// NSIS_SUPPORT_FILE enables support for File (extracting files)
|
||||
#define NSIS_SUPPORT_FILE
|
||||
|
||||
// NSIS_SUPPORT_DELETE enables support for Delete (delete files)
|
||||
#define NSIS_SUPPORT_DELETE
|
||||
|
||||
// NSIS_SUPPORT_RENAME enables support for Rename (rename files)
|
||||
#define NSIS_SUPPORT_RENAME
|
||||
|
||||
// NSIS_SUPPORT_MESSAGEBOX enables support for MessageBox
|
||||
#define NSIS_SUPPORT_MESSAGEBOX
|
||||
|
||||
|
||||
|
||||
// fixes
|
||||
#ifndef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
#ifdef NSIS_CONFIG_LICENSEPAGE
|
||||
#undef NSIS_CONFIG_LICENSEPAGE
|
||||
#endif
|
||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
#undef NSIS_CONFIG_COMPONENTPAGE
|
||||
#endif
|
||||
#ifdef NSIS_SUPPORT_BGBG
|
||||
#undef NSIS_SUPPORT_BGBG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(NSIS_CONFIG_CRC_SUPPORT) && defined(NSIS_CONFIG_VISIBLE_SUPPORT)
|
||||
#define _NSIS_CONFIG_VERIFYDIALOG
|
||||
#endif
|
||||
|
||||
#if defined(NSIS_CONFIG_UNINSTALL_SUPPORT) && defined(NSIS_CONFIG_VISIBLE_SUPPORT)
|
||||
#define _NSIS_CONFIG_UNINSTDLG
|
||||
#endif
|
||||
|
||||
#if defined(NSIS_CONFIG_UNINSTALL_SUPPORT) && defined(NSIS_CONFIG_VISIBLE_SUPPORT)
|
||||
#define _NSIS_CONFIG_UNINSTDLG
|
||||
#endif
|
||||
|
||||
#ifdef EXEHEAD
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
#ifndef NSIS_COMPRESS_USE_ZLIB
|
||||
#ifndef NSIS_COMPRESS_USE_BZIP2
|
||||
#error compression is enabled but both zlib and bzip2 are disabled.
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_COMPRESS_USE_ZLIB
|
||||
#ifdef NSIS_COMPRESS_USE_BZIP2
|
||||
#error both zlib and bzip2 are enabled.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_COMPRESS_USE_ZLIB
|
||||
#ifdef NSIS_ZLIB_COMPRESS_WHOLE
|
||||
#define NSIS_COMPRESS_WHOLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_COMPRESS_USE_BZIP2
|
||||
#ifdef NSIS_BZIP2_COMPRESS_WHOLE
|
||||
#define NSIS_COMPRESS_WHOLE
|
||||
#endif
|
||||
#endif
|
||||
#endif // EXEHEAD
|
||||
|
||||
#ifdef NSIS_COMPRESS_WHOLE
|
||||
#ifndef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
#error NSIS_COMPRESS_WHOLE defined, NSIS_CONFIG_COMPRESSION_SUPPORT not
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_CONFIG_CRC_ANAL
|
||||
#ifndef NSIS_CONFIG_CRC_SUPPORT
|
||||
#error NSIS_CONFIG_CRC_ANAL defined but NSIS_CONFIG_CRC_SUPPORT not
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NSIS_COMPRESS_BZIP2_LEVEL
|
||||
#define NSIS_COMPRESS_BZIP2_LEVEL 9
|
||||
#endif
|
||||
|
||||
#if NSIS_MAX_INST_TYPES > 30
|
||||
#error NSIS_MAX_INST_TYPES > 30
|
||||
#endif
|
||||
|
||||
#endif//!APSTUDIO_INVOKED
|
||||
|
||||
#endif // NSIS_CONFIG_H
|
1423
Source/exehead/exec.c
Normal file
1423
Source/exehead/exec.c
Normal file
File diff suppressed because it is too large
Load diff
7
Source/exehead/exec.h
Normal file
7
Source/exehead/exec.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef _EXEC_H_
|
||||
#define _EXEC_H_
|
||||
|
||||
int ExecuteCodeSegment(entry *entries, int pos, HWND hwndProgress); // returns 0 on success
|
||||
|
||||
|
||||
#endif//_EXEC_H_
|
251
Source/exehead/exehead-bzip2.dsp
Normal file
251
Source/exehead/exehead-bzip2.dsp
Normal file
|
@ -0,0 +1,251 @@
|
|||
# Microsoft Developer Studio Project File - Name="exehead_bzip2" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=exehead_bzip2 - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "exehead-bzip2.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "exehead-bzip2.mak" CFG="exehead_bzip2 - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "exehead_bzip2 - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release-bzip2"
|
||||
# PROP Intermediate_Dir "Release-bzip2"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O1 /Oy /D "_WINDOWS" /D "EXEHEAD" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "WIN32_LEAN_AND_MEAN" /D "NSIS_COMPRESS_USE_BZIP2" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib shell32.lib /nologo /entry:"WinMain" /subsystem:windows /pdb:none /machine:I386 /nodefaultlib /out:"Release-bzip2/exehead_bzip2.exe" /opt:nowin98
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=generating include file for makenssi
|
||||
PostBuild_Cmds=bin2h Release-bzip2\exehead_bzip2.exe Release-bzip2\exehead_bzip2.h bzip2_header_data
|
||||
# End Special Build Tool
|
||||
# Begin Target
|
||||
|
||||
# Name "exehead_bzip2 - Win32 Release"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Group "zlib"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "headers"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Infblock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Infcodes.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Inftrees.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Infutil.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Zconf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Zlib.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\INFBLOCK.C
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\INFCODES.C
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\INFLATE.C
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\INFTREES.C
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\INFUTIL.C
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "bzip2"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\bzlib.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\bzlib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\bzlib_private.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\decompress.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\huffman.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\randtable.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bgbg.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\crc32.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\exec.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\fileform.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Main.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Ui.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\util.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\config.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\exec.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\fileform.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\lang.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\state.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ui.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\util.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bitmap1.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bitmap2.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bitmap3.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\icon3.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsis.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nullsoft.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uninst.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\exehead.xml
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
251
Source/exehead/exehead-zlib.dsp
Normal file
251
Source/exehead/exehead-zlib.dsp
Normal file
|
@ -0,0 +1,251 @@
|
|||
# Microsoft Developer Studio Project File - Name="exehead_zlib" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=exehead_zlib - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "exehead-zlib.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "exehead-zlib.mak" CFG="exehead_zlib - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "exehead_zlib - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release-zlib"
|
||||
# PROP Intermediate_Dir "Release-zlib"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O1 /Oy /D "_WINDOWS" /D "EXEHEAD" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "WIN32_LEAN_AND_MEAN" /D "NSIS_COMPRESS_USE_ZLIB" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib shell32.lib /nologo /entry:"WinMain" /subsystem:windows /pdb:none /machine:I386 /nodefaultlib /out:"Release-zlib/exehead_zlib.exe" /opt:nowin98
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=generating include file for makenssi
|
||||
PostBuild_Cmds=bin2h Release-zlib\exehead_zlib.exe Release-zlib\exehead_zlib.h zlib_header_data bin2h bitmap1.bmp Release-zlib\bitmap1.h bitmap1_data bin2h nsis.ico Release-zlib\icon.h icon_data bin2h uninst.ico Release-zlib\unicon.h unicon_data
|
||||
# End Special Build Tool
|
||||
# Begin Target
|
||||
|
||||
# Name "exehead_zlib - Win32 Release"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Group "zlib"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "headers"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Infblock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Infcodes.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Inftrees.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Infutil.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Zconf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\Zlib.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\INFBLOCK.C
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\INFCODES.C
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\INFLATE.C
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\INFTREES.C
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\INFUTIL.C
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "bzip2"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\bzlib.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\bzlib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\bzlib_private.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\decompress.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\huffman.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\bzip2\randtable.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bgbg.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\crc32.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\exec.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\fileform.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Main.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Ui.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\util.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\config.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\exec.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\fileform.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\lang.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\state.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ui.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\util.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bitmap1.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bitmap2.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bitmap3.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\icon3.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsis.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nullsoft.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uninst.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\exehead.xml
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
10
Source/exehead/exehead.xml
Normal file
10
Source/exehead/exehead.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="Nullsoft.NSIS.exehead" type="win32"/>
|
||||
<description>Nullsoft Install System.</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
323
Source/exehead/fileform.c
Normal file
323
Source/exehead/fileform.c
Normal file
|
@ -0,0 +1,323 @@
|
|||
#include <windows.h>
|
||||
#include "fileform.h"
|
||||
#include "util.h"
|
||||
#include "state.h"
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
#ifdef NSIS_COMPRESS_USE_ZLIB
|
||||
#include "../zlib/zlib.h"
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_COMPRESS_USE_BZIP2
|
||||
#include "../bzip2/bzlib.h"
|
||||
static int bz2_needreinit;
|
||||
#define z_stream bz_stream
|
||||
#define inflateInit(x) { if (BZ2_bzDecompressInit(x)<0) return -1; }
|
||||
#define inflate(x) BZ2_bzDecompress(x)
|
||||
#define inflateReset(x) { if (bz2_needreinit) { BZ2_bzDecompressEnd(x); inflateInit(x); } bz2_needreinit=1; }
|
||||
#define Z_OK BZ_OK
|
||||
#define Z_STREAM_END BZ_STREAM_END
|
||||
#endif//NSIS_COMPRESS_USE_BZIP2
|
||||
|
||||
#endif
|
||||
|
||||
#include "ui.h"
|
||||
|
||||
static char *g_db_strtab;
|
||||
|
||||
static int g_db_offset;
|
||||
HANDLE g_db_hFile;
|
||||
|
||||
#ifdef NSIS_COMPRESS_WHOLE
|
||||
HANDLE dbd_hFile=INVALID_HANDLE_VALUE;
|
||||
static int dbd_size, dbd_pos, dbd_srcpos, dbd_fulllen;
|
||||
#endif//NSIS_COMPRESS_WHOLE
|
||||
|
||||
int isheader(firstheader *h)
|
||||
{
|
||||
if ((h->flags & (~FH_FLAGS_MASK)) ||
|
||||
h->siginfo != FH_SIG ||
|
||||
h->nsinst[2] != FH_INT3 ||
|
||||
h->nsinst[1] != FH_INT2 ||
|
||||
h->nsinst[0] != FH_INT1) return 0;
|
||||
return h->length_of_all_following_data;
|
||||
}
|
||||
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
static z_stream g_inflate_stream;
|
||||
#endif
|
||||
|
||||
int loadHeaders(void)
|
||||
{
|
||||
DWORD r;
|
||||
void *data;
|
||||
firstheader h;
|
||||
|
||||
if (!ReadFile(g_db_hFile,(LPVOID)&h,sizeof(h),&r,NULL) || r != sizeof(h) || !isheader(&h)) return -1;
|
||||
|
||||
data=(void*)GlobalAlloc(GMEM_FIXED,h.length_of_header);
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
inflateInit(&g_inflate_stream);
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_COMPRESS_WHOLE
|
||||
inflateReset(&g_inflate_stream);
|
||||
|
||||
{
|
||||
char fn[MAX_PATH],fno[MAX_PATH];
|
||||
GetTempPath(sizeof(fn),fn);
|
||||
GetTempFileName(fn,"nsi",0,fno);
|
||||
dbd_hFile=CreateFile(fno,GENERIC_WRITE|GENERIC_READ,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE,NULL);
|
||||
if (dbd_hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
MessageBox(NULL,"Error writing temp file",g_caption,MB_OK);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
dbd_srcpos=SetFilePointer(g_db_hFile,0,NULL,FILE_CURRENT);
|
||||
dbd_fulllen=dbd_srcpos-sizeof(h)+h.length_of_all_following_data-((h.flags&FH_FLAGS_CRC)?4:0);
|
||||
#endif
|
||||
|
||||
if (GetCompressedDataFromDataBlockToMemory(-1,data,h.length_of_header) != h.length_of_header)
|
||||
{
|
||||
MessageBox(NULL,"Error reading installer info block",g_caption,MB_OK);
|
||||
GlobalFree((HGLOBAL)data);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef NSIS_COMPRESS_WHOLE
|
||||
g_db_offset=SetFilePointer(g_db_hFile,0,NULL,FILE_CURRENT);
|
||||
#else
|
||||
g_db_offset=dbd_pos;
|
||||
#endif
|
||||
|
||||
g_inst_combinedheader=data;
|
||||
|
||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
if (h.flags&FH_FLAGS_UNINSTALL)
|
||||
{
|
||||
g_is_uninstaller++;
|
||||
g_inst_entry=(entry *) ((g_inst_uninstheader) + 1);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
g_inst_section=(section *) (g_inst_header + 1);
|
||||
g_inst_entry=(entry *) (g_inst_section + g_inst_header->num_sections);
|
||||
}
|
||||
g_db_strtab = (char *)(g_inst_entry + g_inst_cmnheader->num_entries);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *GetStringFromStringTab(int offs)
|
||||
{
|
||||
if (offs < 0) return "";
|
||||
return g_db_strtab+offs;
|
||||
}
|
||||
|
||||
#define IBUFSIZE 16384
|
||||
#define OBUFSIZE 32768
|
||||
|
||||
// returns -3 if compression error/eof/etc
|
||||
|
||||
#ifndef NSIS_COMPRESS_WHOLE
|
||||
|
||||
static int _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen)
|
||||
{
|
||||
static char inbuffer[IBUFSIZE+OBUFSIZE];
|
||||
char *outbuffer;
|
||||
int outbuffer_len=outbuf?outbuflen:OBUFSIZE;
|
||||
int retval=0;
|
||||
int input_len;
|
||||
DWORD r;
|
||||
|
||||
outbuffer = outbuf?outbuf:(inbuffer+IBUFSIZE);
|
||||
|
||||
if (offset>=0)
|
||||
{
|
||||
/*
|
||||
int lp=SetFilePointer(g_db_hFile,0,NULL,FILE_CURRENT);
|
||||
if (lp > g_db_offset+offset)
|
||||
{
|
||||
char buf[1023];
|
||||
wsprintf(buf,"going from %d to %d",lp,g_db_offset+offset);
|
||||
MessageBox(NULL,buf,"seeking back",MB_OK);
|
||||
}
|
||||
*/
|
||||
SetFilePointer(g_db_hFile,g_db_offset+offset,NULL,FILE_BEGIN);
|
||||
}
|
||||
|
||||
if (!ReadFile(g_db_hFile,(LPVOID)&input_len,sizeof(int),&r,NULL)) return -3;
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
else if (input_len & 0x80000000) // compressed
|
||||
{
|
||||
inflateReset(&g_inflate_stream);
|
||||
input_len &= 0x7fffffff; // take off top bit.
|
||||
|
||||
while (input_len > 0)
|
||||
{
|
||||
DWORD r;
|
||||
int err;
|
||||
|
||||
if (!ReadFile(g_db_hFile,(LPVOID)inbuffer,min(input_len,IBUFSIZE),&r,NULL)) return -3;
|
||||
|
||||
g_inflate_stream.next_in = inbuffer;
|
||||
g_inflate_stream.avail_in = r;
|
||||
input_len-=r;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int u;
|
||||
g_inflate_stream.next_out = outbuffer;
|
||||
g_inflate_stream.avail_out = (unsigned int)outbuffer_len;
|
||||
|
||||
err=inflate(&g_inflate_stream);
|
||||
|
||||
if (err<0) return -4;
|
||||
|
||||
u=(char*)g_inflate_stream.next_out - outbuffer;
|
||||
|
||||
if (!u) break;
|
||||
|
||||
if (!outbuf)
|
||||
{
|
||||
if (!WriteFile(hFileOut,outbuffer,u,&r,NULL) || (int)r != u) return -2;
|
||||
retval+=u;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval+=u;
|
||||
outbuffer_len-=u;
|
||||
outbuffer=g_inflate_stream.next_out;
|
||||
if (outbuffer_len < 1) return retval;
|
||||
}
|
||||
if (err==Z_STREAM_END) return retval;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif//NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
else
|
||||
{
|
||||
if (!outbuf)
|
||||
{
|
||||
while (input_len > 0)
|
||||
{
|
||||
DWORD t;
|
||||
if (!ReadFile(g_db_hFile,(LPVOID)inbuffer,min(input_len,outbuffer_len),&r,NULL)) return -3;
|
||||
if (!WriteFile(hFileOut,inbuffer,r,&t,NULL) || r!=t) return -2;
|
||||
retval+=r;
|
||||
input_len-=r;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ReadFile(g_db_hFile,(LPVOID)outbuf,min(input_len,outbuflen),&r,NULL)) return -3;
|
||||
retval=r;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#else//NSIS_COMPRESS_WHOLE
|
||||
|
||||
static char _inbuffer[IBUFSIZE];
|
||||
static char _outbuffer[OBUFSIZE];
|
||||
static int __ensuredata(int amount)
|
||||
{
|
||||
int needed=amount-(dbd_size-dbd_pos);
|
||||
if (needed>0)
|
||||
{
|
||||
SetFilePointer(g_db_hFile,dbd_srcpos,NULL,FILE_BEGIN);
|
||||
SetFilePointer(dbd_hFile,dbd_size,NULL,FILE_BEGIN);
|
||||
for (;;)
|
||||
{
|
||||
int err;
|
||||
DWORD or;
|
||||
if (!ReadFile(g_db_hFile,(LPVOID)_inbuffer,min(IBUFSIZE,dbd_fulllen-dbd_srcpos),&or,NULL)) return -1;
|
||||
dbd_srcpos+=or;
|
||||
g_inflate_stream.next_in=_inbuffer;
|
||||
g_inflate_stream.avail_in=or;
|
||||
do
|
||||
{
|
||||
DWORD r,t;
|
||||
g_inflate_stream.next_out=_outbuffer;
|
||||
g_inflate_stream.avail_out=OBUFSIZE;
|
||||
err=inflate(&g_inflate_stream);
|
||||
if (err<0)
|
||||
{
|
||||
return -3;
|
||||
}
|
||||
r=g_inflate_stream.next_out-_outbuffer;
|
||||
if (r)
|
||||
{
|
||||
if (!WriteFile(dbd_hFile,_outbuffer,r,&t,NULL) || r != t)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
dbd_size+=r;
|
||||
}
|
||||
else if (g_inflate_stream.avail_in || !or) return -3;
|
||||
else break;
|
||||
}
|
||||
while (g_inflate_stream.avail_in);
|
||||
if (amount-(dbd_size-dbd_pos) <= 0) break;
|
||||
}
|
||||
SetFilePointer(dbd_hFile,dbd_pos,NULL,FILE_BEGIN);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen)
|
||||
{
|
||||
DWORD r;
|
||||
int input_len;
|
||||
int retval;
|
||||
if (offset>=0)
|
||||
{
|
||||
dbd_pos=g_db_offset+offset;
|
||||
SetFilePointer(dbd_hFile,dbd_pos,NULL,FILE_BEGIN);
|
||||
}
|
||||
retval=__ensuredata(sizeof(int));
|
||||
if (retval<0) return retval;
|
||||
|
||||
if (!ReadFile(dbd_hFile,(LPVOID)&input_len,sizeof(int),&r,NULL) || r!=sizeof(int)) return -3;
|
||||
dbd_pos+=sizeof(int);
|
||||
|
||||
retval=__ensuredata(input_len);
|
||||
if (retval < 0) return retval;
|
||||
|
||||
if (!outbuf)
|
||||
{
|
||||
while (input_len > 0)
|
||||
{
|
||||
DWORD t;
|
||||
if (!ReadFile(dbd_hFile,(LPVOID)_inbuffer,min(input_len,IBUFSIZE),&r,NULL)) return -3;
|
||||
if (!WriteFile(hFileOut,_inbuffer,r,&t,NULL) || r!=t) return -2;
|
||||
retval+=r;
|
||||
input_len-=r;
|
||||
dbd_pos+=r;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ReadFile(dbd_hFile,(LPVOID)outbuf,min(input_len,outbuflen),&r,NULL)) return -3;
|
||||
retval=r;
|
||||
dbd_pos+=r;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#endif//NSIS_COMPRESS_WHOLE
|
||||
|
||||
|
||||
int GetCompressedDataFromDataBlock(int offset, HANDLE hFileOut)
|
||||
{
|
||||
return _dodecomp(offset,hFileOut,NULL,0);
|
||||
}
|
||||
|
||||
int GetCompressedDataFromDataBlockToMemory(int offset, char *out, int out_len)
|
||||
{
|
||||
return _dodecomp(offset,NULL,out,out_len);
|
||||
}
|
324
Source/exehead/fileform.h
Normal file
324
Source/exehead/fileform.h
Normal file
|
@ -0,0 +1,324 @@
|
|||
#include "config.h"
|
||||
|
||||
#ifndef _FILEFORM_H_
|
||||
#define _FILEFORM_H_
|
||||
|
||||
|
||||
// stored in file:
|
||||
// exehead (~34k)
|
||||
// firstheader (~28 bytes)
|
||||
// hdrinfo (4 bytes describing length/compression)::
|
||||
// (if install)
|
||||
// header (~228 bytes)
|
||||
// sections (20 bytes each)
|
||||
// (if uninstall)
|
||||
// uninstall_header (~116 bytes)
|
||||
// entries (24 bytes each)
|
||||
// string table
|
||||
// datablock
|
||||
// (hdrinfo+datablock is at least 512 bytes if CRC enabled)
|
||||
// CRC (optional - 4 bytes)
|
||||
|
||||
|
||||
#define MAX_ENTRY_OFFSETS 5
|
||||
|
||||
|
||||
// if you want people to not be able to decompile your installers as easily,
|
||||
// reorder the lines following EW_INVALID_OPCODE randomly.
|
||||
|
||||
enum
|
||||
{
|
||||
EW_INVALID_OPCODE, // zero is invalid. useful for catching errors. (otherwise an all zeroes instruction does nothing, which is
|
||||
// easily ignored but means something is wrong.
|
||||
EW_RET, // return from function call
|
||||
EW_NOP, // Nop/Jump, do nothing: 1, [?new address+1:advance one]
|
||||
EW_ABORT, // Abort: 1 [status]
|
||||
EW_QUIT, // Quit: 0
|
||||
EW_CALL, // Call: 1 [new address+1]
|
||||
EW_UPDATETEXT, // Update status text: 2 [update str, ui_st_updateflag=?ui_st_updateflag:this]
|
||||
EW_SLEEP, // Sleep: 1 [sleep time in milliseconds]
|
||||
EW_SETSFCONTEXT, // SetShellVarContext: 1: [isAll]
|
||||
EW_HIDEWINDOW, // HideWindow: 0
|
||||
EW_BRINGTOFRONT, // BringToFront: 0
|
||||
EW_SETWINDOWCLOSE, // SetWindowClose: 1 [0: no window close at end, 1: window close at end]
|
||||
EW_CHDETAILSVIEW, // SetDetailsView: 2 [listaction,buttonaction]
|
||||
EW_SETFILEATTRIBUTES, // SetFileAttributes: 2 [filename, attributes]
|
||||
EW_CREATEDIR, // Create directory: 2, [path, ?update$INSTDIR]
|
||||
EW_IFFILEEXISTS, // IfFileExists: 3, [file name, jump amount if exists, jump amount if not exists]
|
||||
EW_IFERRORS, //a IfErrors: 3 [jump if error, jump if not error, new_erflag]
|
||||
EW_RENAME, // Rename: 3 [old, new, rebootok]
|
||||
EW_GETFULLPATHNAME, // GetFullPathName: 2 [output, input, ?lfn:sfn]
|
||||
EW_SEARCHPATH, // SearchPath: 2 [output, filename]
|
||||
EW_GETTEMPFILENAME, // GetTempFileName: 1 [output]
|
||||
EW_EXTRACTFILE, // File to extract: 5,[overwriteflag, output filename, compressed filedata, filedatetimelow, filedatetimehigh]
|
||||
// overwriteflag: 0x1 = no. 0x0=force, 0x2=try, 0x3=if date is newer
|
||||
EW_DELETEFILE, // Delete File: 2, [filename, rebootok]
|
||||
EW_MESSAGEBOX, // MessageBox: 5,[MB_flags,text,retv1:retv2,moveonretv1:moveonretv2]
|
||||
EW_RMDIR, // RMDir: 2 [path, recursiveflag]
|
||||
EW_STRLEN, // StrLen: 2 [output, input]
|
||||
EW_ASSIGNVAR, // Assign: 4 [variable (0-9) to assign, string to assign, maxlen, startpos]
|
||||
EW_STRCMP, // StrCmp: 4 [str1, str2, jump_if_equal, jump_if_not_equal] (case-insensitive)
|
||||
EW_READENVSTR, // ReadEnvStr/ExpandEnvStrings: 3 [output, string_with_env_variables, IsRead]
|
||||
EW_INTCMP, // IntCmp: 5 [val1, val2, equal, val1<val2, val1>val2]
|
||||
EW_INTCMPU, // IntCmpU: 5 [val1, val2, equal, val1<val2, val1>val2]
|
||||
EW_INTOP, // IntOp: 4 [output, input1, input2, op] where op: 0=add, 1=sub, 2=mul, 3=div, 4=bor, 5=band, 6=bxor, 7=bnot input1, 8=lnot input1, 9=lor, 10=land], 11=1%2
|
||||
EW_INTFMT, // IntFmt: [output, format, input]
|
||||
EW_PUSHPOP, // Push/Pop/Exchange: 3 [variable/string, ?pop:push, ?exch]
|
||||
|
||||
EW_FINDWINDOW, // FindWindow: 5, [outputvar,window class,window name, window_parent, window_after]
|
||||
EW_SENDMESSAGE, // SendMessage: 5 [output, hwnd, msg, lparam, wparam]
|
||||
EW_ISWINDOW, // IsWindow: 3 [hwnd, jump_if_window, jump_if_notwindow]
|
||||
EW_SETDLGITEMTEXT, // SetDlgItemText: 2 [item_id, text]
|
||||
|
||||
EW_SHELLEXEC, // ShellExecute program: 4, [shell action, complete commandline, parameters, showwindow]
|
||||
|
||||
EW_EXECUTE, // Execute program: 3,[complete command line,waitflag,>=0?output errorcode]
|
||||
|
||||
EW_GETFILETIME, // GetFileTime; 3 [file highout lowout]
|
||||
|
||||
EW_GETDLLVERSION, // GetDLLVersion: 3 [file highout lowout]
|
||||
|
||||
EW_REGISTERDLL, // Register DLL: 3,[DLL file name, string ptr of function to call, text to put in display (<0 if none/pass parms)]
|
||||
|
||||
EW_CREATESHORTCUT, // Make Shortcut: 5, [link file, target file, parameters, icon file, iconindex|show mode<<8|hotkey<<16]
|
||||
|
||||
EW_COPYFILES, // CopyFiles: 3 [source mask, destination location, flags]
|
||||
|
||||
EW_REBOOT, // Reboot: 1 [0xbadf00d]
|
||||
EW_IFREBOOTFLAG, // IfRebootFlag: 2 [if reboot flag set, if not reboot flag]
|
||||
EW_SETREBOOTFLAG, // SetRebootFlag: 1 [new value]
|
||||
|
||||
EW_WRITEINI, // Write INI String: 4, [Section, Name, Value, INI File]
|
||||
EW_READINISTR, // ReadINIStr: 4 [output, section, name, ini_file]
|
||||
|
||||
EW_DELREG, // DeleteRegValue/DeleteRegKey: 4, [root key(int), KeyName, ValueName, delkeyonlyifempty]. ValueName is -1 if delete key
|
||||
EW_WRITEREG, // Write Registry value: 5, [RootKey(int),KeyName,ItemName,ItemData,typelen]
|
||||
// typelen=1 for str, 2 for dword, 3 for binary, 0 for expanded str
|
||||
EW_READREGSTR, // ReadRegStr: 5 [output, rootkey(int), keyname, itemname, ==1?int::str]
|
||||
EW_REGENUM, // RegEnum: 5 [output, rootkey, keyname, index, ?key:value]
|
||||
|
||||
EW_FCLOSE, // FileClose: 1 [handle]
|
||||
EW_FOPEN, // FileOpen: 4 [name, openmode, createmode, outputhandle]
|
||||
EW_FPUTS, // FileWrite: 3 [handle, string, ?int:string]
|
||||
EW_FGETS, // FileRead: 4 [handle, output, maxlen, ?getchar:gets]
|
||||
EW_FSEEK, // FileSeek: 4 [handle, offset, mode, >=0?positionoutput]
|
||||
|
||||
EW_FINDCLOSE, // FindClose: 1 [handle]
|
||||
EW_FINDNEXT, // FindNext: 2 [output, handle]
|
||||
EW_FINDFIRST, // FindFirst: 2 [filespec, output, handleoutput]
|
||||
|
||||
EW_WRITEUNINSTALLER, // WriteUninstaller: 1 [name]
|
||||
|
||||
EW_LOG, // LogText: 2 [0, text] / LogSet: [1, logstate]
|
||||
|
||||
EW_SECTIONSET, // SectionSetText: 3: [idx, 0, text]
|
||||
// SectionGetText: 3: [idx, 1, output]
|
||||
// SectionSetFlags: 3: [idx, 2, flags]
|
||||
// SectionGetFlags: 3: [idx, 3, output]
|
||||
|
||||
EW_SETBRANDINGIMAGE, // SetBrandingImage: 1: [Bitmap file]
|
||||
|
||||
// instructions not actually implemented in exehead, but used in compiler.
|
||||
EW_GETLABELADDR, // both of these get converted to EW_ASSIGNVAR
|
||||
EW_GETFUNCTIONADDR,
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// used for section->default_state
|
||||
#define DFS_SET 0x80000000
|
||||
#define DFS_RO 0x40000000
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int flags; // &1=CRC, &2=uninstall, &4=silent
|
||||
int siginfo; // FH_SIG
|
||||
|
||||
int nsinst[3]; // FH_INT1,FH_INT2,FH_INT3
|
||||
|
||||
// these point to the header+sections+entries+stringtable in the datablock
|
||||
int length_of_header;
|
||||
|
||||
// this specifies the length of all the data (including the firstheader and CRC)
|
||||
int length_of_all_following_data;
|
||||
} firstheader;
|
||||
|
||||
// Settings common to both installers and uninstallers
|
||||
typedef struct
|
||||
{
|
||||
// unprocessed strings
|
||||
int branding_ptr;
|
||||
int cancelbutton_ptr;
|
||||
int showdetailsbutton_ptr;
|
||||
int completed_ptr;
|
||||
int closebutton_ptr; // "Close"
|
||||
int name_ptr; // name of installer
|
||||
|
||||
// processed strings
|
||||
int caption_ptr; // name of installer + " Setup" or whatever.
|
||||
int subcaption_ptrs[5];
|
||||
|
||||
#ifdef NSIS_SUPPORT_FILE
|
||||
int fileerrtext_ptr;
|
||||
#endif
|
||||
|
||||
int num_entries; // total number of entries
|
||||
|
||||
#ifdef NSIS_SUPPORT_BGBG
|
||||
int bg_color1, bg_color2, bg_textcolor;
|
||||
#endif
|
||||
int lb_bg, lb_fg, license_bg;
|
||||
|
||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||
// .on* calls
|
||||
int code_onInit;
|
||||
int code_onInstSuccess;
|
||||
int code_onInstFailed;
|
||||
int code_onUserAbort;
|
||||
int code_onNextPage;
|
||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||
|
||||
char show_details;
|
||||
char progress_flags;
|
||||
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
||||
char silent_install;
|
||||
#endif//NSIS_CONFIG_SILENT_SUPPORT
|
||||
// additional flags
|
||||
char misc_flags; // auto_close=&1, no_show_dirpage=&2, no_show_icon&4, no_rootdir&8;
|
||||
|
||||
} common_header;
|
||||
|
||||
// Settings specific to installers
|
||||
typedef struct
|
||||
{
|
||||
// common settings
|
||||
common_header common;
|
||||
|
||||
// these first strings are literals (should not be encoded)
|
||||
int backbutton_ptr;
|
||||
int nextbutton_ptr;
|
||||
int browse_ptr; // "Browse..."
|
||||
int installbutton_ptr; // "Install"
|
||||
int spacerequired_ptr; // "Space required: "
|
||||
int spaceavailable_ptr; // "Space available: "
|
||||
int custom_ptr; // Custom
|
||||
int text_ptr; // directory page text
|
||||
int dirsubtext_ptr; // directory text2
|
||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
int componenttext_ptr; // component page text
|
||||
int componentsubtext_ptr[2];
|
||||
#endif
|
||||
#ifdef NSIS_CONFIG_LICENSEPAGE
|
||||
int licensetext_ptr; // license page text
|
||||
int licensedata_ptr; // license text
|
||||
int licensebutton_ptr; // license button text
|
||||
int license_bg; // license background color
|
||||
#endif//NSIS_CONFIG_LICENSEPAGE
|
||||
|
||||
int install_reg_rootkey, install_reg_key_ptr, install_reg_value_ptr;
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
int install_types_ptr[NSIS_MAX_INST_TYPES]; // -1 if not used. can describe as lite, normal, full, etc.
|
||||
#endif
|
||||
|
||||
// below here, the strings are processed (can have variables etc)
|
||||
int install_directory_ptr; // default install dir.
|
||||
|
||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
int uninstdata_offset; // -1 if no uninst data.
|
||||
int uninsticon_size;
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
int no_custom_instmode_flag;
|
||||
#endif
|
||||
|
||||
int num_sections; // total number of sections
|
||||
|
||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||
// .on* calls
|
||||
int code_onPrevPage;
|
||||
int code_onVerifyInstDir;
|
||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
int code_onSelChange;
|
||||
#endif//NSIS_CONFIG_COMPONENTPAGE
|
||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||
|
||||
} header;
|
||||
|
||||
// Settings specific to uninstallers
|
||||
typedef struct
|
||||
{
|
||||
// common settings
|
||||
common_header common;
|
||||
|
||||
// unprocessed strings
|
||||
int uninstbutton_ptr;
|
||||
int uninstalltext_ptr;
|
||||
int uninstalltext2_ptr;
|
||||
|
||||
int code;
|
||||
int code_size;
|
||||
|
||||
} uninstall_header;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int name_ptr; // '' for non-optional components
|
||||
int default_state; // bits 0-30 set for each of the different install_types, if any.
|
||||
// DFS_SET and DFS_RO can be set too
|
||||
int code;
|
||||
int code_size;
|
||||
int size_kb;
|
||||
int expand;
|
||||
} section;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int which;
|
||||
int offsets[MAX_ENTRY_OFFSETS]; // count and meaning of offsets depend on 'which'
|
||||
} entry;
|
||||
|
||||
|
||||
#define FH_FLAGS_MASK 15
|
||||
#define FH_FLAGS_CRC 1
|
||||
#define FH_FLAGS_UNINSTALL 2
|
||||
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
||||
#define FH_FLAGS_SILENT 4
|
||||
#endif
|
||||
// Added by Amir Szekely 23rd July 2002
|
||||
#define FH_FLAGS_FORCE_CRC 8
|
||||
|
||||
#define FH_SIG 0xDEADBEEF
|
||||
|
||||
// neato surprise signature that goes in firstheader. :)
|
||||
#define FH_INT1 0x6C6C754E
|
||||
#define FH_INT2 0x74666F73
|
||||
#define FH_INT3 0x74736E49
|
||||
|
||||
// the following are only used/implemented in exehead, not makensis.
|
||||
|
||||
int isheader(firstheader *h); // returns 0 on not header, length_of_datablock on success
|
||||
|
||||
// returns nonzero on error
|
||||
// returns 0 on success
|
||||
// on success, m_header will be set to a pointer that should eventually be GlobalFree()'d.
|
||||
// (or m_uninstheader)
|
||||
int loadHeaders(void);
|
||||
|
||||
extern HANDLE g_db_hFile;
|
||||
extern int g_quit_flag;
|
||||
|
||||
const char *GetStringFromStringTab(int offs);
|
||||
int GetCompressedDataFromDataBlock(int offset, HANDLE hFileOut);
|
||||
int GetCompressedDataFromDataBlockToMemory(int offset, char *out, int out_len);
|
||||
|
||||
// $0..$9, $INSTDIR, etc are encoded as ASCII bytes starting from this value.
|
||||
#define VAR_CODES_START (256 - 35)
|
||||
|
||||
|
||||
#endif //_FILEFORM_H_
|
57
Source/exehead/lang.h
Normal file
57
Source/exehead/lang.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
#ifndef _NSIS_LANG_H_
|
||||
#define _NSIS_LANG_H_
|
||||
|
||||
// generic startup strings (these will never be overridable)
|
||||
#define _LANG_INVALIDCRC "Installer verification failed.\r\n\r\n" \
|
||||
"This could be the result of an incomplete download,\r\n" \
|
||||
"a failing disk, or (possibly) corruption from a virus." \
|
||||
"\r\n\r\nYou can try to force an install using the /NCRC\r\n" \
|
||||
"command line switch (but it is NOT recommended)"
|
||||
|
||||
#define _LANG_INVALIDINST "Installer corrupted.\r\n\r\n" \
|
||||
"This could be the result of an incomplete download"
|
||||
|
||||
|
||||
#define _LANG_UNINSTINITERROR "Error initializing uninstaller"
|
||||
|
||||
#define _LANG_VERIFYINGINST "verifying installer: %d%%"
|
||||
|
||||
#define _LANG_CANTOPENSELF "Can't open self"
|
||||
|
||||
#define _LANG_GENERIC_ERROR "NSIS ERROR"
|
||||
|
||||
|
||||
#define LANG_STR(x) (x)
|
||||
|
||||
// instruction strings (these may someday be stored in the datablock or string table, and accessed
|
||||
// via LANG_STR()
|
||||
#define LANG_DELETEFILE "Delete file: "
|
||||
#define LANG_DLLREGERROR "Error registering DLL"
|
||||
#define LANG_REMOVEDIR "Remove directory: "
|
||||
#define LANG_OUTPUTDIR "Output directory: "
|
||||
#define LANG_CREATEDIR "Create directory: "
|
||||
#define LANG_RENAME "Rename: "
|
||||
#define LANG_RENAMEONREBOOT "Rename on reboot: "
|
||||
#define LANG_SKIPPED "Skipped: "
|
||||
#define LANG_CANTWRITE "Can't write: "
|
||||
#define LANG_EXTRACT "Extract: "
|
||||
#define LANG_ERRORWRITING "Extract: error writing to file "
|
||||
#define LANG_ERRORDECOMPRESSING "Error decompressing data! Corrupted installer?"
|
||||
#define LANG_DELETEONREBOOT "Delete on reboot: "
|
||||
#define LANG_EXECSHELL "ExecShell: "
|
||||
#define LANG_EXECUTE "Execute: "
|
||||
#define LANG_CANNOTFINDSYMBOL "Could not find symbol: "
|
||||
#define LANG_COULDNOTLOAD "Could not load: "
|
||||
#define LANG_NOOLE "No OLE for: "
|
||||
#define LANG_ERRORCREATINGSHORTCUT "Error creating shortcut: "
|
||||
#define LANG_CREATESHORTCUT "Create shortcut: "
|
||||
#define LANG_COPYTO "Copy to "
|
||||
#define LANG_COPYFAILED "Copy failed"
|
||||
#define LANG_ERRORCREATING "Error creating: "
|
||||
#define LANG_CREATEDUNINST "Created uninstaller: "
|
||||
#define LANG_INSTCORRUPTED "Install corrupted: invalid opcode"
|
||||
|
||||
|
||||
|
||||
|
||||
#endif//_NSIS_LANG_H_
|
BIN
Source/exehead/nsis.ico
Normal file
BIN
Source/exehead/nsis.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
63
Source/exehead/resource.h
Normal file
63
Source/exehead/resource.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by resource.rc
|
||||
//
|
||||
#define IDC_BACK 3
|
||||
#define IDD_DIALOG1 101
|
||||
#define IDI_ICON1 102
|
||||
#define IDD_DIALOG2 102
|
||||
#define IDD_LICENSE 102
|
||||
#define IDI_ICON2 103
|
||||
#define IDD_DIR 103
|
||||
#define IDD_SELCOM 104
|
||||
#define IDD_INST 105
|
||||
#define IDD_INSTFILES 106
|
||||
#define IDD_UNINST 107
|
||||
#define IDB_BITMAP1 109
|
||||
#define IDB_BITMAP2 110
|
||||
#define IDI_ICON3 110
|
||||
#define IDD_VERIFY 111
|
||||
#define IDB_BITMAP3 111
|
||||
#define IDC_EDIT1 1000
|
||||
#define IDC_BROWSE 1001
|
||||
#define IDC_COPYRIGHT 1003
|
||||
#define IDC_PROGRESS1 1004
|
||||
#define IDC_PROGRESS2 1005
|
||||
#define IDC_INTROTEXT 1006
|
||||
#define IDC_WMA 1007
|
||||
#define IDC_CHECK1 1008
|
||||
#define IDC_MJF 1008
|
||||
#define IDC_VERSION 1009
|
||||
#define IDC_DIRCAPTION 1011
|
||||
#define IDC_STATUSTEXT 1014
|
||||
#define IDC_LICTEXT 1015
|
||||
#define IDC_LIST1 1016
|
||||
#define IDC_COMBO1 1017
|
||||
#define IDC_CHILDRECT 1018
|
||||
#define IDC_DIR 1019
|
||||
#define IDC_SELDIRTEXT 1020
|
||||
#define IDC_TEXT1 1021
|
||||
#define IDC_TEXT2 1022
|
||||
#define IDC_SPACEREQUIRED 1023
|
||||
#define IDC_SPACEAVAILABLE 1024
|
||||
#define IDC_INSTVER 1024
|
||||
#define IDC_UNINSTTEXT 1025
|
||||
#define IDC_PROGRESSTEXT 1026
|
||||
#define IDC_SHOWDETAILS 1027
|
||||
#define IDC_VERSTR 1028
|
||||
#define IDC_UNINSTFROM 1029
|
||||
#define IDC_STR 1030
|
||||
#define IDC_ULICON 1031
|
||||
#define IDC_TREE1 1032
|
||||
#define IDC_BRANDIMAGE 1033
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 112
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1034
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
247
Source/exehead/resource.rc
Normal file
247
Source/exehead/resource.rc
Normal file
|
@ -0,0 +1,247 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
#include "config.h"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
#if defined(APSTUDIO_INVOKED) || defined(NSIS_CONFIG_LICENSEPAGE)
|
||||
#if defined(APSTUDIO_INVOKED)
|
||||
IDD_LICENSE$(NSIS_CONFIG_LICENSEPAGE) DIALOG DISCARDABLE 0, 0, 266, 130
|
||||
#else
|
||||
IDD_LICENSE DIALOG DISCARDABLE 0, 0, 266, 130
|
||||
#endif
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDI_ICON2,IDC_ULICON,0,0,20,20
|
||||
LTEXT "",IDC_INTROTEXT,25,0,241,23
|
||||
CONTROL "",IDC_EDIT1,"RICHEDIT",ES_MULTILINE | ES_READONLY |
|
||||
WS_VSCROLL | WS_BORDER,0,24,266,105
|
||||
END
|
||||
#endif
|
||||
|
||||
#if defined(APSTUDIO_INVOKED) || defined(NSIS_CONFIG_VISIBLE_SUPPORT)
|
||||
#if defined(APSTUDIO_INVOKED)
|
||||
IDD_DIR$(NSIS_CONFIG_VISIBLE_SUPPORT) DIALOG DISCARDABLE 0, 0, 266, 130
|
||||
#else
|
||||
IDD_DIR DIALOG DISCARDABLE 0, 0, 266, 130
|
||||
#endif
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_DIR,11,49,188,12,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "",IDC_BROWSE,203,48,50,14
|
||||
ICON IDI_ICON2,IDC_ULICON,0,0,20,20
|
||||
CONTROL "",IDC_SELDIRTEXT,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,
|
||||
0,36,265,8
|
||||
CONTROL "",IDC_SPACEAVAILABLE,"Static",SS_LEFTNOWORDWRAP |
|
||||
WS_GROUP,0,122,265,8
|
||||
CONTROL "",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE |
|
||||
WS_TABSTOP,12,65,118,10
|
||||
CONTROL "",IDC_SPACEREQUIRED,"Static",SS_LEFTNOWORDWRAP |
|
||||
WS_GROUP,0,111,265,8
|
||||
LTEXT "",IDC_INTROTEXT,25,0,241,34
|
||||
END
|
||||
#endif
|
||||
|
||||
#if defined(APSTUDIO_INVOKED) || defined(NSIS_CONFIG_COMPONENTPAGE)
|
||||
#if defined(APSTUDIO_INVOKED)
|
||||
IDD_SELCOM$(NSIS_CONFIG_COMPONENTPAGE) DIALOG DISCARDABLE 0, 0, 266, 130
|
||||
#else
|
||||
IDD_SELCOM DIALOG DISCARDABLE 0, 0, 266, 130
|
||||
#endif
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
COMBOBOX IDC_COMBO1,114,25,152,102,CBS_DROPDOWNLIST | WS_VSCROLL |
|
||||
WS_TABSTOP
|
||||
ICON IDI_ICON2,IDC_ULICON,0,0,20,20
|
||||
LTEXT "",IDC_TEXT2,0,40,108,21
|
||||
CONTROL "",IDC_TEXT1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,0,27,
|
||||
108,8
|
||||
CONTROL "",IDC_SPACEREQUIRED,"Static",SS_LEFTNOWORDWRAP |
|
||||
WS_GROUP,0,111,111,8
|
||||
LTEXT "",IDC_INTROTEXT,25,0,241,25
|
||||
CONTROL "Tree1",IDC_TREE1,"SysTreeView32",TVS_HASBUTTONS |
|
||||
TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP |
|
||||
WS_BORDER | WS_TABSTOP,114,39,151,90
|
||||
END
|
||||
#endif
|
||||
|
||||
#if defined(APSTUDIO_INVOKED) || defined(NSIS_CONFIG_VISIBLE_SUPPORT)
|
||||
#if defined(APSTUDIO_INVOKED)
|
||||
IDD_INST$(NSIS_CONFIG_VISIBLE_SUPPORT) DIALOG DISCARDABLE 0, 0, 280, 162
|
||||
#else
|
||||
IDD_INST DIALOG DISCARDABLE 0, 0, 280, 162
|
||||
#endif
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
PUSHBUTTON "",IDOK,223,142,50,14
|
||||
PUSHBUTTON "",IDCANCEL,7,142,50,14
|
||||
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,138,267,1
|
||||
CONTROL "",IDC_CHILDRECT,"Static",SS_BLACKRECT | NOT WS_VISIBLE,
|
||||
7,6,266,130
|
||||
PUSHBUTTON "",IDC_BACK,171,142,50,14,NOT WS_VISIBLE
|
||||
CTEXT "",IDC_VERSTR,59,145,108,8,WS_DISABLED
|
||||
END
|
||||
#endif
|
||||
|
||||
#if defined(APSTUDIO_INVOKED) || defined(NSIS_CONFIG_VISIBLE_SUPPORT)
|
||||
#if defined(APSTUDIO_INVOKED)
|
||||
IDD_INSTFILES$(NSIS_CONFIG_VISIBLE_SUPPORT) DIALOG DISCARDABLE 0, 0, 266, 130
|
||||
#else
|
||||
IDD_INSTFILES DIALOG DISCARDABLE 0, 0, 266, 130
|
||||
#endif
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "",IDC_PROGRESS1,"msctls_progress32",NOT WS_VISIBLE |
|
||||
WS_BORDER,24,10,241,11
|
||||
CONTROL "",IDC_PROGRESS2,"msctls_progress32",PBS_SMOOTH | NOT
|
||||
WS_VISIBLE | WS_BORDER,24,10,241,11
|
||||
CONTROL "",IDC_INTROTEXT,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,
|
||||
24,0,241,8
|
||||
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SINGLESEL |
|
||||
LVS_NOCOLUMNHEADER | NOT WS_VISIBLE | WS_BORDER |
|
||||
WS_TABSTOP, 0,25,265,104
|
||||
ICON IDI_ICON2,IDC_ULICON,0,0,20,20
|
||||
PUSHBUTTON "",IDC_SHOWDETAILS,0,28,50,14,NOT WS_TABSTOP
|
||||
END
|
||||
#endif
|
||||
|
||||
#if defined(APSTUDIO_INVOKED) || defined(_NSIS_CONFIG_UNINSTDLG)
|
||||
#if defined(APSTUDIO_INVOKED)
|
||||
IDD_UNINST$(_NSIS_CONFIG_UNINSTDLG) DIALOG DISCARDABLE 0, 0, 266, 130
|
||||
#else
|
||||
IDD_UNINST DIALOG DISCARDABLE 0, 0, 266, 130
|
||||
#endif
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDI_ICON2,IDC_ULICON,0,1,20,20
|
||||
LTEXT "",IDC_UNINSTFROM,0,45,55,8
|
||||
EDITTEXT IDC_EDIT1,56,43,209,12,ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "",IDC_INTROTEXT,25,0,241,34
|
||||
END
|
||||
#endif
|
||||
|
||||
#if defined(APSTUDIO_INVOKED) || defined(_NSIS_CONFIG_VERIFYDIALOG)
|
||||
#if defined(APSTUDIO_INVOKED)
|
||||
IDD_VERIFY$(_NSIS_CONFIG_VERIFYDIALOG) DIALOG DISCARDABLE 0, 0, 162, 22
|
||||
#else
|
||||
IDD_VERIFY DIALOG DISCARDABLE 0, 0, 162, 22
|
||||
#endif
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CTEXT "",IDC_STR,7,7,148,8
|
||||
END
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
"IDD_INST$(NSIS_CONFIG_VISIBLE_SUPPORT)", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 273
|
||||
TOPMARGIN, 6
|
||||
BOTTOMMARGIN, 156
|
||||
END
|
||||
|
||||
"IDD_INSTFILES$(NSIS_CONFIG_VISIBLE_SUPPORT)", DIALOG
|
||||
BEGIN
|
||||
RIGHTMARGIN, 246
|
||||
BOTTOMMARGIN, 125
|
||||
END
|
||||
|
||||
"IDD_VERIFY$(_NSIS_CONFIG_VERIFYDIALOG)", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 155
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 15
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"#include ""config.h""\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON2 ICON DISCARDABLE "nsis.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
#if defined(APSTUDIO_INVOKED) || defined(NSIS_CONFIG_COMPONENTPAGE)
|
||||
#if defined(APSTUDIO_INVOKED)
|
||||
IDB_BITMAP1$(NSIS_CONFIG_COMPONENTPAGE) BITMAP DISCARDABLE "bitmap1.bmp"
|
||||
#else
|
||||
IDB_BITMAP1 BITMAP DISCARDABLE "bitmap1.bmp"
|
||||
#endif
|
||||
#endif
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
11
Source/exehead/state.h
Normal file
11
Source/exehead/state.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
extern char g_usrvars[24][NSIS_MAX_STRLEN];
|
||||
#define state_command_line (g_usrvars[20])
|
||||
#define state_install_directory (g_usrvars[21])
|
||||
#define state_output_directory (g_usrvars[22])
|
||||
#define state_exe_directory (g_usrvars[23])
|
||||
|
||||
extern char g_caption[NSIS_MAX_STRLEN*2];
|
||||
extern HWND g_hwnd;
|
||||
extern int g_filehdrsize;
|
||||
extern HANDLE g_hInstance;
|
||||
extern HWND insthwnd,insthwndbutton;
|
21
Source/exehead/ui.h
Normal file
21
Source/exehead/ui.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef _UI_H_
|
||||
#define _UI_H_
|
||||
|
||||
int ui_doinstall(void);
|
||||
void update_status_text(const char *text1, const char *text2);
|
||||
extern int ui_st_updateflag;
|
||||
|
||||
extern char g_autoclose;
|
||||
extern void *g_inst_combinedheader;
|
||||
extern section *g_inst_section;
|
||||
extern entry *g_inst_entry;
|
||||
|
||||
#define g_inst_header ((header *)g_inst_combinedheader)
|
||||
#define g_inst_cmnheader ((common_header *)g_inst_combinedheader)
|
||||
|
||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
#define g_inst_uninstheader ((uninstall_header *)g_inst_combinedheader)
|
||||
extern int g_is_uninstaller;
|
||||
#endif
|
||||
|
||||
#endif//_UI_H_
|
BIN
Source/exehead/uninst.ico
Normal file
BIN
Source/exehead/uninst.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
548
Source/exehead/util.c
Normal file
548
Source/exehead/util.c
Normal file
|
@ -0,0 +1,548 @@
|
|||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#include "util.h"
|
||||
#include "state.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "fileform.h"
|
||||
#include "ui.h"
|
||||
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
char g_log_file[1024];
|
||||
#endif
|
||||
|
||||
char g_usrvars[24][NSIS_MAX_STRLEN];
|
||||
|
||||
HANDLE g_hInstance;
|
||||
|
||||
HANDLE myCreateProcess(char *cmd, char *dir)
|
||||
{
|
||||
PROCESS_INFORMATION ProcInfo={0,};
|
||||
STARTUPINFO StartUp={0,};
|
||||
StartUp.cb=sizeof(StartUp);
|
||||
if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, dir, &StartUp, &ProcInfo))
|
||||
return NULL;
|
||||
if (NULL != ProcInfo.hThread) CloseHandle( ProcInfo.hThread );
|
||||
return ProcInfo.hProcess;
|
||||
}
|
||||
|
||||
|
||||
void addtrailingslash(char *str)
|
||||
{
|
||||
if (lastchar(str)!='\\') lstrcat(str,"\\");
|
||||
}
|
||||
|
||||
char lastchar(const char *str)
|
||||
{
|
||||
return *CharPrev(str,str+lstrlen(str));
|
||||
}
|
||||
|
||||
void trimslashtoend(char *buf)
|
||||
{
|
||||
char *p=scanendslash(buf);
|
||||
if (p<buf) p=buf;
|
||||
*p=0;
|
||||
}
|
||||
|
||||
|
||||
char *scanendslash(const char *str)
|
||||
{
|
||||
char *s=CharPrev(str,str+lstrlen(str));
|
||||
if (!*str) return (char*)str-1;
|
||||
for (;;)
|
||||
{
|
||||
char *t;
|
||||
if ('\\' == *s) return s;
|
||||
t=CharPrev(str,s);
|
||||
if (t==s) return (char*)str-1;
|
||||
s=t;
|
||||
}
|
||||
}
|
||||
|
||||
int validpathspec(char *ubuf)
|
||||
{
|
||||
return ((ubuf[0]=='\\' && ubuf[1]=='\\') || (ubuf[0] && *(ubuf+1)==':'));
|
||||
}
|
||||
|
||||
int is_valid_instpath(char *s)
|
||||
{
|
||||
int ivp=0;
|
||||
// if 8 is set, req is 0, which means rootdirs are not allowed.
|
||||
int req=!(g_inst_cmnheader->misc_flags&8);
|
||||
if (s[0] == '\\' && s[1] == '\\') // \\ path
|
||||
{
|
||||
if (lastchar(s)!='\\') ivp++;
|
||||
while (*s)
|
||||
{
|
||||
if (*s == '\\') ivp++;
|
||||
if (*s) s++;
|
||||
}
|
||||
ivp/=5-req;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*s)
|
||||
{
|
||||
if (*s) s++;
|
||||
if (*s == ':')
|
||||
{
|
||||
if (*s) s++;
|
||||
if (*s == '\\')
|
||||
{
|
||||
if (*s) s++;
|
||||
if (req || (*s && *s != '\\')) ivp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ivp;
|
||||
}
|
||||
|
||||
static char *findinmem(char *a, char *b, int len_of_a)
|
||||
{
|
||||
if (len_of_a<0) len_of_a=lstrlen(a);
|
||||
len_of_a -= lstrlen(b);
|
||||
while (*a && len_of_a >= 0)
|
||||
{
|
||||
char *t=a,*u=b;
|
||||
while (*t && *t == *u)
|
||||
{
|
||||
t++;
|
||||
u++;
|
||||
}
|
||||
if (!*u) return a;
|
||||
a++;
|
||||
len_of_a--;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void *mini_memcpy(void *out, const void *in, int len)
|
||||
{
|
||||
char *c_out=(char*)out;
|
||||
char *c_in=(char *)in;
|
||||
while (len-- > 0)
|
||||
{
|
||||
*c_out++=*c_in++;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
HANDLE myOpenFile(const char *fn, DWORD da, DWORD cd)
|
||||
{
|
||||
return CreateFile(fn,da,FILE_SHARE_READ,NULL,cd,0,NULL);
|
||||
}
|
||||
|
||||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
BOOL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
||||
{
|
||||
BOOL fOk = 0;
|
||||
HMODULE hLib=LoadLibrary("kernel32.dll");
|
||||
if (hLib)
|
||||
{
|
||||
typedef BOOL (WINAPI *mfea_t)(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,DWORD dwFlags);
|
||||
mfea_t mfea;
|
||||
mfea=(mfea_t) GetProcAddress(hLib,"MoveFileExA");
|
||||
if (mfea)
|
||||
{
|
||||
fOk=mfea(pszExisting, pszNew, MOVEFILE_DELAY_UNTIL_REBOOT|MOVEFILE_REPLACE_EXISTING);
|
||||
}
|
||||
FreeLibrary(hLib);
|
||||
}
|
||||
|
||||
if (!fOk)
|
||||
{
|
||||
static char szRenameLine[1024];
|
||||
static char wininit[1024];
|
||||
static char tmpbuf[1024];
|
||||
int cchRenameLine;
|
||||
char *szRenameSec = "[Rename]\r\n";
|
||||
HANDLE hfile, hfilemap;
|
||||
DWORD dwFileSize, dwRenameLinePos;
|
||||
static const char nulint[4]="NUL";
|
||||
|
||||
if (pszNew) GetShortPathName(pszNew,tmpbuf,1024);
|
||||
else *((int *)tmpbuf) = *((int *)nulint);
|
||||
// wininit is used as a temporary here
|
||||
GetShortPathName(pszExisting,wininit,1024);
|
||||
cchRenameLine = wsprintf(szRenameLine,"%s=%s\r\n",tmpbuf,wininit);
|
||||
|
||||
GetWindowsDirectory(wininit, 1024-16);
|
||||
lstrcat(wininit, "\\wininit.ini");
|
||||
hfile = CreateFile(wininit,
|
||||
GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
|
||||
if (hfile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
dwFileSize = GetFileSize(hfile, NULL);
|
||||
hfilemap = CreateFileMapping(hfile, NULL, PAGE_READWRITE, 0, dwFileSize + cchRenameLine + 10, NULL);
|
||||
|
||||
if (hfilemap != NULL)
|
||||
{
|
||||
LPSTR pszWinInit = (LPSTR) MapViewOfFile(hfilemap, FILE_MAP_WRITE, 0, 0, 0);
|
||||
|
||||
if (pszWinInit != NULL)
|
||||
{
|
||||
int do_write=0;
|
||||
LPSTR pszRenameSecInFile = findinmem(pszWinInit, szRenameSec,-1);
|
||||
if (pszRenameSecInFile == NULL)
|
||||
{
|
||||
lstrcpy(pszWinInit+dwFileSize, szRenameSec);
|
||||
dwFileSize += 10;
|
||||
dwRenameLinePos = dwFileSize;
|
||||
do_write++;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *pszFirstRenameLine = findinmem(pszRenameSecInFile, "\n",-1)+1;
|
||||
int l=pszWinInit + dwFileSize-pszFirstRenameLine;
|
||||
if (!findinmem(pszFirstRenameLine,szRenameLine,l))
|
||||
{
|
||||
void* data=(void*)GlobalAlloc(GMEM_FIXED,l);
|
||||
mini_memcpy(data, pszFirstRenameLine, l);
|
||||
mini_memcpy(pszFirstRenameLine + cchRenameLine, data, l);
|
||||
GlobalFree((HGLOBAL)data);
|
||||
|
||||
dwRenameLinePos = pszFirstRenameLine - pszWinInit;
|
||||
do_write++;
|
||||
}
|
||||
}
|
||||
|
||||
if (do_write)
|
||||
{
|
||||
mini_memcpy(&pszWinInit[dwRenameLinePos], szRenameLine,cchRenameLine);
|
||||
dwFileSize += cchRenameLine;
|
||||
}
|
||||
|
||||
UnmapViewOfFile(pszWinInit);
|
||||
|
||||
fOk++;
|
||||
}
|
||||
CloseHandle(hfilemap);
|
||||
}
|
||||
SetFilePointer(hfile, dwFileSize, NULL, FILE_BEGIN);
|
||||
SetEndOfFile(hfile);
|
||||
CloseHandle(hfile);
|
||||
}
|
||||
}
|
||||
return fOk;
|
||||
}
|
||||
#endif
|
||||
|
||||
void recursive_create_directory(char *directory)
|
||||
{
|
||||
char *tp;
|
||||
char *p;
|
||||
p=directory;
|
||||
while (*p == ' ') if (*p) p++;
|
||||
if (!*p) return;
|
||||
tp=*p?p+1:p;
|
||||
if (*tp == ':' && tp[1] == '\\') p=tp+2;
|
||||
else if (p[0] == '\\' && p[1] == '\\')
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < 2; x ++)
|
||||
{
|
||||
while (*p != '\\' && *p) if (*p) p++; // skip host then share
|
||||
if (*p) if (*p) p++;
|
||||
}
|
||||
|
||||
}
|
||||
else return;
|
||||
while (*p)
|
||||
{
|
||||
while (*p != '\\' && *p) if (*p) p++;
|
||||
if (!*p) CreateDirectory(directory,NULL);
|
||||
else
|
||||
{
|
||||
*p=0;
|
||||
CreateDirectory(directory,NULL);
|
||||
*p++ = '\\';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void myRegGetStr(HKEY root, const char *sub, const char *name, char *out)
|
||||
{
|
||||
HKEY hKey;
|
||||
*out=0;
|
||||
if (RegOpenKeyEx(root,sub,0,KEY_READ,&hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD l = NSIS_MAX_STRLEN;
|
||||
DWORD t;
|
||||
if (RegQueryValueEx(hKey,name,NULL,&t,out,&l ) != ERROR_SUCCESS || t != REG_SZ) *out=0;
|
||||
out[NSIS_MAX_STRLEN-1]=0;
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char g_all_user_var_flag;
|
||||
|
||||
static void queryShellFolders(const char *name, char *out)
|
||||
{
|
||||
char f=g_all_user_var_flag;
|
||||
again:
|
||||
|
||||
myRegGetStr(g_all_user_var_flag?HKEY_LOCAL_MACHINE:HKEY_CURRENT_USER,
|
||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
|
||||
name+(f?0:7),out);
|
||||
if (!out[0])
|
||||
{
|
||||
if (f)
|
||||
{
|
||||
f=0; goto again;
|
||||
}
|
||||
GetTempPath(NSIS_MAX_STRLEN,out);
|
||||
}
|
||||
}
|
||||
|
||||
char ps_tmpbuf[NSIS_MAX_STRLEN*2];
|
||||
|
||||
|
||||
void process_string_fromtab(char *out, int offs)
|
||||
{
|
||||
process_string(ps_tmpbuf,GetStringFromStringTab(offs));
|
||||
lstrcpyn(out,ps_tmpbuf,NSIS_MAX_STRLEN);
|
||||
}
|
||||
|
||||
void myitoa(char *s, int d) { wsprintf(s,"%d",d); }
|
||||
int myatoi(char *s)
|
||||
{
|
||||
unsigned int v=0;
|
||||
if (*s == '0' && (s[1] == 'x' || s[1] == 'X'))
|
||||
{
|
||||
s+=2;
|
||||
for (;;)
|
||||
{
|
||||
int c=*s++;
|
||||
if (c >= '0' && c <= '9') c-='0';
|
||||
else if (c >= 'a' && c <= 'f') c-='a'-10;
|
||||
else if (c >= 'A' && c <= 'F') c-='A'-10;
|
||||
else break;
|
||||
v<<=4;
|
||||
v+=c;
|
||||
}
|
||||
}
|
||||
else if (*s == '0' && s[1] <= '7' && s[1] >= '0')
|
||||
{
|
||||
s++;
|
||||
for (;;)
|
||||
{
|
||||
int c=*s++;
|
||||
if (c >= '0' && c <= '7') c-='0';
|
||||
else break;
|
||||
v<<=3;
|
||||
v+=c;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int sign=0;
|
||||
if (*s == '-') { s++; sign++; }
|
||||
for (;;)
|
||||
{
|
||||
int c=*s++ - '0';
|
||||
if (c < 0 || c > 9) break;
|
||||
v*=10;
|
||||
v+=c;
|
||||
}
|
||||
if (sign) return -(int) v;
|
||||
}
|
||||
return (int)v;
|
||||
}
|
||||
|
||||
|
||||
int process_string_fromtab_toint(int offs)
|
||||
{
|
||||
process_string(ps_tmpbuf,GetStringFromStringTab(offs));
|
||||
return myatoi(ps_tmpbuf);
|
||||
}
|
||||
|
||||
// Dave Laundon's simplified process_string
|
||||
void process_string(char *out, const char *in)
|
||||
{
|
||||
char *outsave = out;
|
||||
while (*in && out - outsave < NSIS_MAX_STRLEN)
|
||||
{
|
||||
int nVarIdx = (unsigned char)*in++;
|
||||
if (nVarIdx < VAR_CODES_START)
|
||||
{
|
||||
*out++ = nVarIdx;
|
||||
}
|
||||
else if (nVarIdx == 255)
|
||||
{
|
||||
*out++ = *in++;
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD f;
|
||||
switch (nVarIdx) // The order of this list must match that in ..\strlist.cpp (err, build.cpp -J)
|
||||
{
|
||||
case VAR_CODES_START + 0: // HWNDPARENT
|
||||
wsprintf(out, "%u", (unsigned int)g_hwnd);
|
||||
break;
|
||||
case VAR_CODES_START + 1: // 0
|
||||
case VAR_CODES_START + 2: // 1
|
||||
case VAR_CODES_START + 3: // 2
|
||||
case VAR_CODES_START + 4: // 3
|
||||
case VAR_CODES_START + 5: // 4
|
||||
case VAR_CODES_START + 6: // 5
|
||||
case VAR_CODES_START + 7: // 6
|
||||
case VAR_CODES_START + 8: // 7
|
||||
case VAR_CODES_START + 9: // 8
|
||||
case VAR_CODES_START + 10: // 9
|
||||
case VAR_CODES_START + 11: // R0
|
||||
case VAR_CODES_START + 12: // R1
|
||||
case VAR_CODES_START + 13: // R2
|
||||
case VAR_CODES_START + 14: // R3
|
||||
case VAR_CODES_START + 15: // R4
|
||||
case VAR_CODES_START + 16: // R5
|
||||
case VAR_CODES_START + 17: // R6
|
||||
case VAR_CODES_START + 18: // R7
|
||||
case VAR_CODES_START + 19: // R8
|
||||
case VAR_CODES_START + 20: // R9
|
||||
case VAR_CODES_START + 21: // CMDLINE
|
||||
case VAR_CODES_START + 22: // INSTDIR
|
||||
case VAR_CODES_START + 23: // OUTDIR
|
||||
case VAR_CODES_START + 24: // EXEDIR
|
||||
lstrcpy(out, g_usrvars[nVarIdx - (VAR_CODES_START + 1)]);
|
||||
break;
|
||||
|
||||
case VAR_CODES_START + 25: // PROGRAMFILES
|
||||
myRegGetStr(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProgramFilesDir", out);
|
||||
if (!*out)
|
||||
lstrcpy(out, "C:\\Program Files");
|
||||
break;
|
||||
|
||||
case VAR_CODES_START + 26: // SMPROGRAMS
|
||||
case VAR_CODES_START + 27: // SMSTARTUP
|
||||
case VAR_CODES_START + 28: // DESKTOP
|
||||
case VAR_CODES_START + 29: // STARTMENU
|
||||
{
|
||||
static const char *tab[]={
|
||||
"Common Programs",
|
||||
"Common Startup",
|
||||
"Common Desktop",
|
||||
"Common Start Menu"
|
||||
};
|
||||
queryShellFolders(tab[nVarIdx-(VAR_CODES_START+26)], out);
|
||||
}
|
||||
break;
|
||||
|
||||
case VAR_CODES_START + 30: // QUICKLAUNCH
|
||||
queryShellFolders("Common AppData", out);
|
||||
lstrcat(out, "\\Microsoft\\Internet Explorer\\Quick Launch");
|
||||
f = GetFileAttributes(out);
|
||||
if (f != (DWORD)-1 && (f & FILE_ATTRIBUTE_DIRECTORY))
|
||||
break;
|
||||
case VAR_CODES_START + 31: // TEMP
|
||||
GetTempPath(NSIS_MAX_STRLEN, out);
|
||||
break;
|
||||
|
||||
case VAR_CODES_START + 32: // WINDIR
|
||||
GetWindowsDirectory(out, NSIS_MAX_STRLEN);
|
||||
break;
|
||||
|
||||
case VAR_CODES_START + 33: // SYSDIR
|
||||
GetSystemDirectory(out, NSIS_MAX_STRLEN);
|
||||
break;
|
||||
|
||||
#if VAR_CODES_START + 33 >= 255
|
||||
#error "Too many variables! Extend VAR_CODES_START!"
|
||||
#endif
|
||||
} // switch
|
||||
// remove trailing slash
|
||||
while (*out && *(out+1)) out++;
|
||||
if (nVarIdx > 21+VAR_CODES_START && *out == '\\') // only if not $0 to $R9, $CMDLINE, or $HWNDPARENT
|
||||
*out = 0;
|
||||
if (*out) out++;
|
||||
} // >= VAR_CODES_START
|
||||
} // while
|
||||
*out = 0;
|
||||
}
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
|
||||
char log_text[4096];
|
||||
int log_dolog;
|
||||
void log_write(int close)
|
||||
{
|
||||
extern char g_log_file[1024];
|
||||
static HANDLE fp=INVALID_HANDLE_VALUE;
|
||||
if (close)
|
||||
{
|
||||
if (fp!=INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle(fp);
|
||||
}
|
||||
fp=INVALID_HANDLE_VALUE;
|
||||
return;
|
||||
}
|
||||
if (log_dolog)
|
||||
{
|
||||
if (g_log_file[0] && fp==INVALID_HANDLE_VALUE)
|
||||
{
|
||||
fp = CreateFile(g_log_file,GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_ALWAYS,0,NULL);
|
||||
if (fp!=INVALID_HANDLE_VALUE)
|
||||
SetFilePointer(fp,0,NULL,FILE_END);
|
||||
}
|
||||
if (fp!=INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD d;
|
||||
lstrcat(log_text,"\r\n");
|
||||
WriteFile(fp,log_text,lstrlen(log_text),&d,NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_SUPPORT_CREATESHORTCUT
|
||||
int CreateShortCut(HWND hwnd, LPCSTR pszShortcutFile, LPCSTR pszIconFile, int iconindex, LPCSTR pszExe, LPCSTR pszArg, LPCSTR workingdir, int showmode, int hotkey)
|
||||
{
|
||||
HRESULT hres;
|
||||
int rv=1;
|
||||
IShellLink* psl;
|
||||
hres=OleInitialize(NULL);
|
||||
if (hres != S_FALSE && hres != S_OK) return rv;
|
||||
|
||||
hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IShellLink, (void **) &psl);
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
IPersistFile* ppf;
|
||||
|
||||
hres = psl->lpVtbl->QueryInterface(psl,&IID_IPersistFile, (void **) &ppf);
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
|
||||
hres = psl->lpVtbl->SetPath(psl,pszExe);
|
||||
psl->lpVtbl->SetWorkingDirectory(psl,workingdir);
|
||||
if (showmode) psl->lpVtbl->SetShowCmd(psl,showmode);
|
||||
if (hotkey) psl->lpVtbl->SetHotkey(psl,(unsigned short)hotkey);
|
||||
if (pszIconFile) psl->lpVtbl->SetIconLocation(psl,pszIconFile,iconindex);
|
||||
if (pszArg)
|
||||
{
|
||||
psl->lpVtbl->SetArguments(psl,pszArg);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
WCHAR wsz[1024];
|
||||
MultiByteToWideChar(CP_ACP, 0, pszShortcutFile, -1, wsz, 1024);
|
||||
hres=ppf->lpVtbl->Save(ppf,(const WCHAR*)wsz,TRUE);
|
||||
if (SUCCEEDED(hres)) rv=0;
|
||||
}
|
||||
ppf->lpVtbl->Release(ppf);
|
||||
}
|
||||
psl->lpVtbl->Release(psl);
|
||||
}
|
||||
OleUninitialize();
|
||||
return rv;
|
||||
}
|
||||
#endif//NSIS_SUPPORT_CREATESHORTCUT
|
47
Source/exehead/util.h
Normal file
47
Source/exehead/util.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
#include "config.h"
|
||||
|
||||
void recursive_create_directory(char *directory);
|
||||
|
||||
extern char ps_tmpbuf[NSIS_MAX_STRLEN*2];
|
||||
void process_string(char *out, const char *in);
|
||||
void process_string_fromtab(char *out, int offs);
|
||||
int process_string_fromtab_toint(int offs);
|
||||
void myRegGetStr(HKEY root, const char *sub, const char *name, char *out);
|
||||
int myatoi(char *s);
|
||||
void myitoa(char *s, int d);
|
||||
|
||||
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
extern char log_text[NSIS_MAX_STRLEN*4];
|
||||
void log_write(int close);
|
||||
#define log_printf(x1) wsprintf(log_text,x1); log_write(0)
|
||||
#define log_printf2(x1,x2) wsprintf(log_text,x1,x2); log_write(0)
|
||||
#define log_printf3(x1,x2,x3) wsprintf(log_text,x1,x2,x3); log_write(0)
|
||||
#define log_printf4(x1,x2,x3,x4) wsprintf(log_text,x1,x2,x3,x4); log_write(0)
|
||||
#define log_printf5(x1,x2,x3,x4,x5) wsprintf(log_text,x1,x2,x3,x4,x5); log_write(0)
|
||||
#define log_printf6(x1,x2,x3,x4,x5,x6) wsprintf(log_text,x1,x2,x3,x4,x5,x6); log_write(0)
|
||||
#define log_printf8(x1,x2,x3,x4,x5,x6,x7,x8) wsprintf(log_text,x1,x2,x3,x4,x5,x6,x7,x8); log_write(0)
|
||||
extern int log_dolog;
|
||||
extern char g_log_file[1024];
|
||||
#else
|
||||
#define log_printf(x1)
|
||||
#define log_printf2(x1,x2)
|
||||
#define log_printf3(x1,x2,x3)
|
||||
#define log_printf4(x1,x2,x3,x4)
|
||||
#define log_printf5(x1,x2,x3,x4,x5)
|
||||
#define log_printf6(x1,x2,x3,x4,x5,x6)
|
||||
#define log_printf8(x1,x2,x3,x4,x5,x6,x7,x8)
|
||||
#endif
|
||||
|
||||
HANDLE myCreateProcess(char *cmd, char *dir);
|
||||
|
||||
HANDLE myOpenFile(const char *fn, DWORD da, DWORD cd);
|
||||
int CreateShortCut(HWND hwnd, LPCSTR pszShortcutFile, LPCSTR pszIconFile, int iconindex, LPCSTR pszExe, LPCSTR pszArg, LPCSTR workingdir, int showmode, int hotkey);
|
||||
int validpathspec(char *ubuf);
|
||||
void addtrailingslash(char *str);
|
||||
char lastchar(const char *str);
|
||||
void trimslashtoend(char *buf);
|
||||
char *scanendslash(const char *str);
|
||||
int is_valid_instpath(char *s);
|
||||
BOOL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew);
|
||||
void *mini_memcpy(void *out, const void *in, int len);
|
Loading…
Add table
Add a link
Reference in a new issue