Updated System plugin - Win9x fixes and more
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2350 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
6788c2222f
commit
3667a05636
7 changed files with 51 additions and 51 deletions
|
@ -567,7 +567,10 @@ void ParamsIn(SystemProc *proc)
|
||||||
*((__int64*) place) = myatoi(realbuf);
|
*((__int64*) place) = myatoi(realbuf);
|
||||||
break;
|
break;
|
||||||
case PAT_STRING:
|
case PAT_STRING:
|
||||||
*((int*) place) = (int) AllocStr(realbuf);
|
/* if (proc->Params[i].Input == IOT_NONE)
|
||||||
|
*((int*) place) = (int) NULL;
|
||||||
|
else*/
|
||||||
|
*((int*) place) = (int) AllocStr(realbuf);
|
||||||
break;
|
break;
|
||||||
case PAT_BOOLEAN:
|
case PAT_BOOLEAN:
|
||||||
*((int*) place) = lstrcmpi(realbuf, "true");
|
*((int*) place) = lstrcmpi(realbuf, "true");
|
||||||
|
@ -650,6 +653,8 @@ void ParamsOut(SystemProc *proc)
|
||||||
while (i >= 0);
|
while (i >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _alloca_probe();
|
||||||
|
|
||||||
SystemProc __declspec(naked) *CallProc(SystemProc *proc)
|
SystemProc __declspec(naked) *CallProc(SystemProc *proc)
|
||||||
{
|
{
|
||||||
int z3;
|
int z3;
|
||||||
|
@ -669,22 +674,28 @@ SystemProc __declspec(naked) *CallProc(SystemProc *proc)
|
||||||
|
|
||||||
if ((CallbackIndex > 0) && ((proc->Options & POPT_GENSTACK) == 0))
|
if ((CallbackIndex > 0) && ((proc->Options & POPT_GENSTACK) == 0))
|
||||||
{
|
{
|
||||||
if (LastStackPlace == 0)
|
|
||||||
{
|
|
||||||
// Create new stack
|
|
||||||
LastStackPlace = (int) GlobalAlloc(GPTR, NEW_STACK_SIZE);
|
|
||||||
// Point to stack end
|
|
||||||
LastStackPlace += NEW_STACK_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
// Save previous stack location
|
|
||||||
push ebp
|
push ebp
|
||||||
|
// Save previous stack location
|
||||||
mov LastStackReal, esp
|
mov LastStackReal, esp
|
||||||
// Move stack pointer
|
|
||||||
mov esp, LastStackPlace
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LastStackPlace == 0)
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
// Create new stack
|
||||||
|
mov eax, NEW_STACK_SIZE
|
||||||
|
call _alloca_probe
|
||||||
|
mov LastStackPlace, esp
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
// Move stack pointer
|
||||||
|
mov esp, LastStackPlace
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push arguments to stack
|
// Push arguments to stack
|
||||||
|
@ -735,7 +746,7 @@ SystemProc __declspec(naked) *CallProc(SystemProc *proc)
|
||||||
// In case of cdecl convention we should clear stack
|
// In case of cdecl convention we should clear stack
|
||||||
if ((proc->Options & POPT_CDECL) != 0)
|
if ((proc->Options & POPT_CDECL) != 0)
|
||||||
{
|
{
|
||||||
if ((CallbackIndex > 0) && ((LastProc->Options & POPT_GENSTACK) == 0))
|
if ((CallbackIndex > 0) && ((proc->Options & POPT_GENSTACK) == 0))
|
||||||
{
|
{
|
||||||
// In case of temporary stack
|
// In case of temporary stack
|
||||||
for (z3 = 1; z3 <= proc->ParamCount; z3++)
|
for (z3 = 1; z3 <= proc->ParamCount; z3++)
|
||||||
|
@ -752,6 +763,9 @@ SystemProc __declspec(naked) *CallProc(SystemProc *proc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In case of cleared call-proc-queue -> clear allocated stack place (more flexible)
|
||||||
|
if (LastProc == NULL) LastStackPlace = NULL;
|
||||||
|
|
||||||
// Save return
|
// Save return
|
||||||
proc->Params[0].Value = z1;
|
proc->Params[0].Value = z1;
|
||||||
if (proc->Params[0].Size == 2)
|
if (proc->Params[0].Size == 2)
|
||||||
|
@ -935,6 +949,7 @@ HANDLE CreateCallback(SystemProc *cbproc)
|
||||||
|
|
||||||
void CallStruct(SystemProc *proc)
|
void CallStruct(SystemProc *proc)
|
||||||
{
|
{
|
||||||
|
BOOL ssflag = FALSE; // structsize flag -> structure size should be loaded
|
||||||
int i, structsize = 0, size = 0;
|
int i, structsize = 0, size = 0;
|
||||||
char *st, *ptr;
|
char *st, *ptr;
|
||||||
|
|
||||||
|
@ -974,16 +989,12 @@ void CallStruct(SystemProc *proc)
|
||||||
switch (proc->Params[i].Type)
|
switch (proc->Params[i].Type)
|
||||||
{
|
{
|
||||||
case PAT_VOID: ptr = NULL; break;
|
case PAT_VOID: ptr = NULL; break;
|
||||||
case PAT_INT:
|
|
||||||
// clear unused value bits
|
|
||||||
proc->Params[i].Value &= intmask[((size >= 0) && (size < 4))?(size):(0)];
|
|
||||||
// pointer
|
|
||||||
ptr = (char*) &(proc->Params[i].Value);
|
|
||||||
break;
|
|
||||||
case PAT_LONG:
|
case PAT_LONG:
|
||||||
// real structure size
|
// real structure size
|
||||||
proc->Params[i].Value = structsize;
|
proc->Params[i].Value = structsize;
|
||||||
proc->Params[i]._value = 0;
|
proc->Params[i]._value = 0;
|
||||||
|
ssflag = TRUE;
|
||||||
|
case PAT_INT:
|
||||||
// clear unused value bits
|
// clear unused value bits
|
||||||
proc->Params[i].Value &= intmask[((size >= 0) && (size < 4))?(size):(0)];
|
proc->Params[i].Value &= intmask[((size >= 0) && (size < 4))?(size):(0)];
|
||||||
// pointer
|
// pointer
|
||||||
|
@ -997,7 +1008,7 @@ void CallStruct(SystemProc *proc)
|
||||||
if (ptr != NULL)
|
if (ptr != NULL)
|
||||||
{
|
{
|
||||||
// Input
|
// Input
|
||||||
if (proc->Params[i].Input != IOT_NONE)
|
if ((proc->Params[i].Input != IOT_NONE) || (ssflag))
|
||||||
copymem(st, ptr, size);
|
copymem(st, ptr, size);
|
||||||
|
|
||||||
// Output
|
// Output
|
||||||
|
@ -1013,20 +1024,6 @@ void CallStruct(SystemProc *proc)
|
||||||
proc->Params[0].Value = (int) proc->Proc;
|
proc->Params[0].Value = (int) proc->Proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*__int64 __declspec(dllexport) just(__int64 a, __int64 b, __int64 *c)
|
|
||||||
{
|
|
||||||
*c += a*b + 8402934020348;
|
|
||||||
return a*b+(*c);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*typedef int (__stdcall *func)(int a, int b);
|
|
||||||
|
|
||||||
int __declspec(dllexport) cbtest(func f)
|
|
||||||
{
|
|
||||||
return f(5, 10);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
g_hInstance=hInst;
|
g_hInstance=hInst;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#define SYSTEM_API __declspec(dllimport)
|
#define SYSTEM_API __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NEW_STACK_SIZE 65536
|
#define NEW_STACK_SIZE 256*256
|
||||||
|
|
||||||
// Proc types:
|
// Proc types:
|
||||||
#define PT_NOTHING 0
|
#define PT_NOTHING 0
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="kernel32.lib user32.lib vc7ldvrm.obj vc7lmul.obj vc7lshl.obj vc7lshr.obj "
|
AdditionalDependencies="kernel32.lib user32.lib vc7ldvrm.obj vc7lmul.obj vc7lshl.obj vc7lshr.obj chkstk.obj"
|
||||||
OutputFile="$(OutDir)/System.dll"
|
OutputFile="$(OutDir)/System.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
IgnoreAllDefaultLibraries="TRUE"
|
IgnoreAllDefaultLibraries="TRUE"
|
||||||
|
|
BIN
Contrib/System/Source/chkstk.obj
Normal file
BIN
Contrib/System/Source/chkstk.obj
Normal file
Binary file not shown.
|
@ -83,22 +83,17 @@ Function systemGetFileSysTime
|
||||||
; close file search
|
; close file search
|
||||||
System::Call '${sysFindClose}(r3)'
|
System::Call '${sysFindClose}(r3)'
|
||||||
|
|
||||||
; Create systemtime struct for system time
|
|
||||||
System::Call '*${stSYSTEMTIME} .R1'
|
|
||||||
; Create systemtime struct for local time
|
; Create systemtime struct for local time
|
||||||
System::Call '*${stSYSTEMTIME} .R0'
|
System::Call '*${stSYSTEMTIME} .R0'
|
||||||
|
|
||||||
; Get File time
|
; Get File time
|
||||||
System::Call '*$2${stWIN32_FIND_DATA} (,,, .r3)'
|
System::Call '*$2${stWIN32_FIND_DATA} (,,, .r3)'
|
||||||
|
|
||||||
|
; Convert file time (UTC) to local file time
|
||||||
|
System::Call '${sysFileTimeToLocalFileTime}(r3, .r1)'
|
||||||
|
|
||||||
; Convert file time to system time
|
; Convert file time to system time
|
||||||
System::Call '${sysFileTimeToSystemTime}(r3, R1)'
|
System::Call '${sysFileTimeToSystemTime}(r1, R0)'
|
||||||
|
|
||||||
; Convert system time to local time
|
|
||||||
System::Call '${sysSystemTimeToTzSpecificLocalTime}(0, R1, R0)'
|
|
||||||
|
|
||||||
; that's all, just clear used memory
|
|
||||||
System::Free $R1
|
|
||||||
|
|
||||||
sgfst_exit:
|
sgfst_exit:
|
||||||
; free used memory for WIN32_FIND_DATA struct
|
; free used memory for WIN32_FIND_DATA struct
|
||||||
|
@ -138,22 +133,25 @@ Function systemMessageBox
|
||||||
|
|
||||||
; Load module and get handle
|
; Load module and get handle
|
||||||
System::Call '${sysLoadLibrary}($2) .r1'
|
System::Call '${sysLoadLibrary}($2) .r1'
|
||||||
IntCmp $1 0 "0" smbnext smbnext
|
IntCmp $1 0 0 smbnext smbnext
|
||||||
|
|
||||||
; Get module handle. This may look stupid (to call GetModuleHandle in case
|
; Get module handle. This may look stupid (to call GetModuleHandle in case
|
||||||
; when the LoadLibrary doesn't works, but LoadLibrary couldn't return
|
; when the LoadLibrary doesn't works, but LoadLibrary couldn't return
|
||||||
; a handle to starting process (for 'i 0').
|
; a handle to starting process (for 'i 0').
|
||||||
System::Call '${sysGetModuleHandle}($2) .r1'
|
System::Call '${sysGetModuleHandle}($2) .r1'
|
||||||
smbnext:
|
|
||||||
|
|
||||||
|
; Indicate that LoadLibrary wasn't used
|
||||||
|
StrCpy $2 1
|
||||||
|
smbnext:
|
||||||
; Create MSGBOXPARAMS structure
|
; Create MSGBOXPARAMS structure
|
||||||
System::Call '*${stMSGBOXPARAMS}(, $HWNDPARENT, r1, r3, r4, "$5|${MB_USERICON}", $6, _) .r0'
|
System::Call '*${stMSGBOXPARAMS}(, $HWNDPARENT, r1, r3, r4, "$5|${MB_USERICON}", $6, _) .r0'
|
||||||
; call MessageBoxIndirect
|
; call MessageBoxIndirect
|
||||||
System::Call '${sysMessageBoxIndirect}(r0) .R0'
|
System::Call '${sysMessageBoxIndirect}(r0) .R0'
|
||||||
; free MSGBOXPARAMS structure
|
; free MSGBOXPARAMS structure
|
||||||
|
|
||||||
System::Free $0
|
System::Free $0
|
||||||
|
|
||||||
; have we got ready module handle at start?
|
; have we used load library at start?
|
||||||
IntCmp $2 0 0 smbskipfree smbskipfree
|
IntCmp $2 0 0 smbskipfree smbskipfree
|
||||||
; No, then free the module
|
; No, then free the module
|
||||||
System::Call '${sysFreeLibrary}(r1)'
|
System::Call '${sysFreeLibrary}(r1)'
|
||||||
|
@ -331,7 +329,7 @@ Function systemSplash
|
||||||
Pop $3
|
Pop $3
|
||||||
|
|
||||||
; Create window class
|
; Create window class
|
||||||
System::Call "*${stWNDCLASS} (,r3,,,r7,,R9,,,s) .R9" "_sp"
|
System::Call "*${stWNDCLASS} (0,r3,0,0,r7,0,R9,0,i 0,'_sp') .R9"
|
||||||
|
|
||||||
; Register window class
|
; Register window class
|
||||||
System::Call "${sysRegisterClass} (R9) .R9"
|
System::Call "${sysRegisterClass} (R9) .R9"
|
||||||
|
@ -373,8 +371,8 @@ repeat:
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
; Stop the sound
|
; Stop the sound
|
||||||
System::Call "${sysPlaySound}"
|
System::Call "${sysPlaySound} (i 0, i 0, i 0)"
|
||||||
|
|
||||||
; Delete bitmap object
|
; Delete bitmap object
|
||||||
System::Call "${sysDeleteObject} (r6)"
|
System::Call "${sysDeleteObject} (r6)"
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,11 @@
|
||||||
; LPSYSTEMTIME lpSystemTime);
|
; LPSYSTEMTIME lpSystemTime);
|
||||||
!define sysFileTimeToSystemTime 'kernel32::FileTimeToSystemTime(*l, i) i'
|
!define sysFileTimeToSystemTime 'kernel32::FileTimeToSystemTime(*l, i) i'
|
||||||
|
|
||||||
|
; BOOL FileTimeToLocalFileTime(
|
||||||
|
; CONST FILETIME *lpFileTime,
|
||||||
|
; LPFILETIME lpLocalFileTime);
|
||||||
|
!define sysFileTimeToLocalFileTime 'kernel32::FileTimeToLocalFileTime(*l, *l) i'
|
||||||
|
|
||||||
; BOOL SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZone,
|
; BOOL SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZone,
|
||||||
; LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime);
|
; LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime);
|
||||||
!define sysSystemTimeToTzSpecificLocalTime 'kernel32::SystemTimeToTzSpecificLocalTime(i, i, i) i'
|
!define sysSystemTimeToTzSpecificLocalTime 'kernel32::SystemTimeToTzSpecificLocalTime(i, i, i) i'
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue