new system plugin
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1459 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
4284cfc5da
commit
d785ba2d70
19 changed files with 1968 additions and 624 deletions
|
@ -3,91 +3,79 @@
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
#include "Buffers.h"
|
#include "Buffers.h"
|
||||||
|
|
||||||
PLUGINFUNCTION(AllocCopy)
|
PLUGINFUNCTIONSHORT(Alloc)
|
||||||
int mem;
|
{
|
||||||
|
|
||||||
if (popint(&mem) == 0)
|
|
||||||
{
|
|
||||||
pushint(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mem = (int) GlobalCopy((HANDLE) mem);
|
|
||||||
pushint(mem);
|
|
||||||
PLUGINFUNCTIONEND
|
|
||||||
|
|
||||||
PLUGINFUNCTION(Alloc)
|
|
||||||
int size;
|
int size;
|
||||||
int mem;
|
if ((size = popint()) == 0)
|
||||||
|
|
||||||
if (popint(&size) == 0)
|
|
||||||
{
|
{
|
||||||
pushint(0);
|
pushint(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
pushint((int) GlobalAlloc(GPTR, size));
|
||||||
mem = (int) GlobalAlloc(GPTR, size);
|
}
|
||||||
pushint(mem);
|
|
||||||
PLUGINFUNCTIONEND
|
PLUGINFUNCTIONEND
|
||||||
|
|
||||||
PLUGINFUNCTION(Free)
|
PLUGINFUNCTIONSHORT(Copy)
|
||||||
int mem;
|
{
|
||||||
|
int size = 0;
|
||||||
|
HANDLE source, dest;
|
||||||
|
char *str;
|
||||||
|
// Get the string
|
||||||
|
if ((str = popstring()) == NULL) return;
|
||||||
|
|
||||||
if ((popint(&mem) == 0) || (mem == 0))
|
// Check for size option
|
||||||
{
|
if (str[0] == '/')
|
||||||
pushstring("false");
|
{
|
||||||
return;
|
size = (int) myatoi(str+1);
|
||||||
}
|
dest = popint();
|
||||||
if ((GlobalFree((HANDLE) mem) == NULL)) pushstring("true");
|
}
|
||||||
else pushstring("false");
|
else dest = (HANDLE) myatoi(str+1);
|
||||||
|
source = popint();
|
||||||
|
|
||||||
|
// Ok, check the size
|
||||||
|
if (size == 0) size = (int) GlobalSize(source);
|
||||||
|
// and the destinantion
|
||||||
|
if ((int) dest == 0) dest = GlobalAlloc((GPTR), size);
|
||||||
|
|
||||||
|
// COPY!
|
||||||
|
copymem(dest, source, size);
|
||||||
|
|
||||||
|
GlobalFree(str);
|
||||||
|
}
|
||||||
PLUGINFUNCTIONEND
|
PLUGINFUNCTIONEND
|
||||||
|
|
||||||
/*typedef BOOL (__stdcall *GetDiskSpace)
|
PLUGINFUNCTIONSHORT(Free)
|
||||||
(
|
{
|
||||||
LPCTSTR lpDirectoryName, // directory name
|
char *str;
|
||||||
PULARGE_INTEGER lpFreeBytesAvailable, // bytes available to caller
|
// Get the string
|
||||||
PULARGE_INTEGER lpTotalNumberOfBytes, // bytes on disk
|
if ((str = popstring()) == NULL) return;
|
||||||
PULARGE_INTEGER lpTotalNumberOfFreeBytes // free bytes on disk
|
// Check for callback clear
|
||||||
);*/
|
if (lstrcmpi(str,"/callback") == 0)
|
||||||
|
{
|
||||||
/*PLUGINFUNCTION(MyFunction)
|
SystemProc *proc, *next;
|
||||||
GetDiskSpace proc;
|
next = (SystemProc*) popint();
|
||||||
ULARGE_INTEGER i1, i2, i3;
|
// Clear all the clone queue of callback
|
||||||
BOOL check;
|
while ((proc = next) != NULL)
|
||||||
|
|
||||||
proc = (GetDiskSpace) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetDiskFreeSpaceExA");
|
|
||||||
check = proc(NULL, &i1, &i2, &i3);
|
|
||||||
|
|
||||||
_asm
|
|
||||||
{
|
{
|
||||||
push ecx
|
next = proc->Clone;
|
||||||
lea ecx, i3
|
GlobalFree((HANDLE)proc);
|
||||||
push ecx
|
|
||||||
lea ecx, i2
|
|
||||||
push ecx
|
|
||||||
lea ecx, i1
|
|
||||||
push ecx
|
|
||||||
push 0
|
|
||||||
|
|
||||||
call proc
|
|
||||||
|
|
||||||
mov check, eax
|
|
||||||
// add esp, 16
|
|
||||||
pop ecx
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
GlobalFree((HANDLE) myatoi(str));
|
||||||
|
GlobalFree(str);
|
||||||
|
}
|
||||||
|
PLUGINFUNCTIONEND
|
||||||
|
|
||||||
char buf[1024];
|
char *copymem(char *output, char *input, int size)
|
||||||
wsprintf(buf,"$0=%s\n",getuservariable(INST_0));
|
{
|
||||||
MessageBox(g_hwndParent,buf,0,MB_OK);
|
char *out = output;
|
||||||
PLUGINFUNCTIONEND*/
|
while (size-- > 0) *(out++) = *(input++);
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE GlobalCopy(HANDLE Old)
|
HANDLE GlobalCopy(HANDLE Old)
|
||||||
{
|
{
|
||||||
SIZE_T size;
|
SIZE_T size = GlobalSize(Old);
|
||||||
HANDLE n;
|
return copymem(GlobalAlloc(GPTR, size), Old, (int) size);
|
||||||
|
|
||||||
size = GlobalSize(Old);
|
|
||||||
n = GlobalAlloc(GPTR, size);
|
|
||||||
CopyMemory(n, Old, size);
|
|
||||||
return n;
|
|
||||||
}
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
extern HANDLE GlobalCopy(HANDLE Old);
|
extern HANDLE GlobalCopy(HANDLE Old);
|
||||||
|
extern char *copymem(char *output, char *input, int size);
|
35
Contrib/System/Example.txt
Normal file
35
Contrib/System/Example.txt
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
; Memory for paths
|
||||||
|
System::Alloc 1024
|
||||||
|
Pop $1
|
||||||
|
; Get drives
|
||||||
|
System::Call 'kernel32::GetLogicalDriveStringsA(i 1024, i r1) i'
|
||||||
|
enumok:
|
||||||
|
; One more drive?
|
||||||
|
System::Call 'kernel32::lstrlenA(i r1) i.r2'
|
||||||
|
IntCmp $2 0 enumex
|
||||||
|
|
||||||
|
; Drive space
|
||||||
|
System::Call 'kernel32::GetDiskFreeSpaceExA(i r1, *l .r3, *l .r4, *l .r5) i'
|
||||||
|
|
||||||
|
; Pretty KBs
|
||||||
|
System::Int64Op $3 / 1024
|
||||||
|
Pop $3
|
||||||
|
System::Int64Op $4 / 1024
|
||||||
|
Pop $4
|
||||||
|
System::Int64Op $5 / 1024
|
||||||
|
Pop $5
|
||||||
|
|
||||||
|
; Get pretty drive path string
|
||||||
|
System::Call '*$1(&t1024 .r6)'
|
||||||
|
; Message box
|
||||||
|
System::Call 'user32::MessageBoxA(i $HWNDPARENT, t "Path: `$6`, Free for Caller: $3 kb, Free for All: $5 kb, Disk Size: $4 kb", t "Disk spaces example", i 33) i.r0'
|
||||||
|
; User cancel?
|
||||||
|
IntCmp $0 2 enumex
|
||||||
|
|
||||||
|
; Next drive path
|
||||||
|
IntOp $1 $1 + $2
|
||||||
|
IntOp $1 $1 + 1
|
||||||
|
goto enumok
|
||||||
|
enumex: ; End of drives or user cancel
|
||||||
|
; Free memory for paths
|
||||||
|
System::Free $1
|
120
Contrib/System/New System.txt
Normal file
120
Contrib/System/New System.txt
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
Additional notes:
|
||||||
|
1. if you are using callbacks you should set SetPluginUnload
|
||||||
|
to alwaysoff.
|
||||||
|
2. If you are using inline input syntax, you shouldn't use the same quotes for
|
||||||
|
quoting inlines and the whole defenition. Use \ as escape character (for ex.:
|
||||||
|
\" will be replaced with ").
|
||||||
|
|
||||||
|
----------- Main functions -----------
|
||||||
|
|
||||||
|
RESULT/PROC System::Get "Proc"
|
||||||
|
RESULT/RETURN System::Call "Proc" StackArgs...
|
||||||
|
|
||||||
|
These functions return error RESULTs or PROC/RETURN in OK case.
|
||||||
|
Error result is "error" and callback results are "callbackN", where N is
|
||||||
|
callback index.
|
||||||
|
|
||||||
|
----------- Additional functions -----------
|
||||||
|
|
||||||
|
System::Int64Op ARG1 OP1
|
||||||
|
System::Int64Op ARG1 OP2 ARG2
|
||||||
|
Performs operation on ARG1 and ARG2 (or on ARG1 only at single argument
|
||||||
|
operator cases) and returns result on stack. Here are the OP2s: +, -, *, / DIV,
|
||||||
|
% MOD, | OR, & AND, ^ XOR, || LOGIC-OR, && LOGIC-AND, < BELOW, > ABOVE, = EQUAL.
|
||||||
|
There are only 2 OP1s: ~ (BITWISE-NOT) and ! (LOGIC-NOT).
|
||||||
|
|
||||||
|
System::Alloc SIZE
|
||||||
|
Allocates SIZE bytes and returns the pointer on stack.
|
||||||
|
|
||||||
|
System::Copy 0 SOURCE
|
||||||
|
System::Copy DESTINATION SOURCE
|
||||||
|
System::Copy /SIZE 0 SOURCE
|
||||||
|
System::Copy /SIZE DESTINATION SOURCE
|
||||||
|
Copys data from source to destination, if /SIZE option and SIZE itself
|
||||||
|
are undefined uses GlobalSize to determine source size. If destination is equal
|
||||||
|
to 0, allocates the new memory block.
|
||||||
|
|
||||||
|
System::Free ADDR
|
||||||
|
System::Free /callback ADDR
|
||||||
|
Frees memory used by object at ADDR. If /callback option is specified,
|
||||||
|
then ADDR is considered to be the addr of CALLBACK proc, and will be cleared
|
||||||
|
accordingly (must be used!).
|
||||||
|
|
||||||
|
----------- Get/Call syntaxis -----------
|
||||||
|
|
||||||
|
Syntax:
|
||||||
|
"Proc(Params)Return?Options#Proc(Params)Return?Options..."
|
||||||
|
|
||||||
|
Proc:
|
||||||
|
dll::proc -> Proc from DLL
|
||||||
|
::addr -> Handle to system proc (memory address)
|
||||||
|
*addr -> Structure
|
||||||
|
* -> New structure
|
||||||
|
nothing -> Dup proc, usually callback or for future defenition
|
||||||
|
|
||||||
|
proc -> Ready proc specification for use or redefinition
|
||||||
|
|
||||||
|
|
||||||
|
If in System::Call proc specification points to already existing proc,
|
||||||
|
the existing proc will be adapted and executed, otherwise the new proc will be
|
||||||
|
created, executed and deleted.
|
||||||
|
|
||||||
|
Params syntax: (Param1, Param2, Param3...), the number of params of proc is set
|
||||||
|
to number of params at last Params section (so params cutting may ocur). If you
|
||||||
|
need to save previous Param defenition use '_' after last param at Params
|
||||||
|
section - no param cutting will ocur for it (section).
|
||||||
|
Syntax of single param: "Type Source Destination", type can be omitted (previous
|
||||||
|
or void will be used), each of Source and Destination can be replaced with
|
||||||
|
'.' placeholder. Any parameter can be omitted at all - previous or default
|
||||||
|
values will be used (example: "(i1,,i2)", 2nd arg omitted).
|
||||||
|
|
||||||
|
Return section is like single param defenition, but the Source defenition is
|
||||||
|
never used, beside callback cases.
|
||||||
|
|
||||||
|
Params & Return - Type:
|
||||||
|
v - void (generaly for return)
|
||||||
|
i - int (includes char, byte, short, handles, pointers and so on)
|
||||||
|
l - long & large integer (know as int64)
|
||||||
|
t - text, string (LPCSTR, pointer to first character)
|
||||||
|
b - boolean (needs/returns 'true':'false') - by the fact this type is
|
||||||
|
senseless -> usual integer can be used ('0':'1')
|
||||||
|
k - callback. See Callback section.
|
||||||
|
|
||||||
|
* - pointer specifier -> the proc needs the pointer to type, affects
|
||||||
|
next char (parameter) [ex: '*i' - pointer to int]
|
||||||
|
|
||||||
|
For structures: & - additional meaning specificator.
|
||||||
|
&v - padding, &vN - pad for N bytes
|
||||||
|
&i - smaller types: &i4, &i2 (short), &i1 (byte)
|
||||||
|
&t - structure contains plain text, &tN - lenght == N bytes.
|
||||||
|
|
||||||
|
Params & Return - Source / Destination:
|
||||||
|
. - makes no change to source
|
||||||
|
0..9 - starts numeric inline input (accepts 0..9, x, |)
|
||||||
|
" / ' / ` - starts / ends string inline input, use \ to escape chars
|
||||||
|
Registers $0-$9 -> r(0..9)
|
||||||
|
Registers $R0-$R9 -> 'r(10..19)' or 'R(0..9)'
|
||||||
|
Additional regs -> c(Cmdline) d(instDir) o(Outdir) e(Exedir) a(lAng)
|
||||||
|
Stack -> s (you could pass arguments from Call line, see examples)
|
||||||
|
None -> n (0 (null) for input / specifies no output is required)
|
||||||
|
|
||||||
|
Options (any option can be turned off (returned to default value) by specifing
|
||||||
|
'!' where needed, for example _stdcall cc can be turned on by '!c'):
|
||||||
|
c - _cdecl calling convention (the stack restored by caller). By default
|
||||||
|
stdcall calling convention is used (the stack restored by callee).
|
||||||
|
r - always return (for GET means you should pop result and proc,
|
||||||
|
for CALL means you should pop result (at least)). By default result is returned
|
||||||
|
for errors only (for GET you will pop either error result or right
|
||||||
|
proc, and for CALL you will get either your return or result at defined
|
||||||
|
return place.
|
||||||
|
n - no redefine. Whenever this proc will be used it will never be
|
||||||
|
redefined either by GET or CALL. This options is never inherited to childs.
|
||||||
|
s - use general Stack. Whenever the first callback defined the system
|
||||||
|
starts using the temporary stacks for function calls.
|
||||||
|
|
||||||
|
Callback: you should check for callbacked return after every function call
|
||||||
|
which can use your callback. Genereal scheme is:
|
||||||
|
1. Check result for callback or normal return
|
||||||
|
2. Input arguments defined for callback are at places.
|
||||||
|
3. Place output and return arguments
|
||||||
|
4. Call System::Call using callback proc handle
|
|
@ -7,31 +7,47 @@ int g_stringsize;
|
||||||
stack_t **g_stacktop;
|
stack_t **g_stacktop;
|
||||||
char *g_variables;
|
char *g_variables;
|
||||||
|
|
||||||
int popstring(char *str)
|
char *AllocString()
|
||||||
{
|
{
|
||||||
stack_t *th;
|
return (char*) GlobalAlloc(GPTR,g_stringsize);
|
||||||
if (!g_stacktop || !*g_stacktop) return 0;
|
|
||||||
th=(*g_stacktop);
|
|
||||||
lstrcpy(str,th->text);
|
|
||||||
*g_stacktop = th->next;
|
|
||||||
GlobalFree((HGLOBAL)th);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushstring(char *str)
|
char *AllocStr(char *str)
|
||||||
|
{
|
||||||
|
return lstrcpy(AllocString(), str);
|
||||||
|
}
|
||||||
|
|
||||||
|
char* popstring()
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
stack_t *th;
|
||||||
|
|
||||||
|
if (!g_stacktop || !*g_stacktop) return NULL;
|
||||||
|
th=(*g_stacktop);
|
||||||
|
|
||||||
|
str = AllocString();
|
||||||
|
lstrcpy(str,th->text);
|
||||||
|
|
||||||
|
*g_stacktop = th->next;
|
||||||
|
GlobalFree((HGLOBAL)th);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *pushstring(char *str)
|
||||||
{
|
{
|
||||||
stack_t *th;
|
stack_t *th;
|
||||||
if (!g_stacktop) return;
|
if (!g_stacktop) return str;
|
||||||
th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize);
|
th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize);
|
||||||
lstrcpyn(th->text,str,g_stringsize);
|
lstrcpyn(th->text,str,g_stringsize);
|
||||||
th->next=*g_stacktop;
|
th->next=*g_stacktop;
|
||||||
*g_stacktop=th;
|
*g_stacktop=th;
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getuservariable(int varnum)
|
char *getuservariable(int varnum)
|
||||||
{
|
{
|
||||||
if (varnum < 0 || varnum >= __INST_LAST) return NULL;
|
if (varnum < 0 || varnum >= __INST_LAST) return AllocString();
|
||||||
return g_variables+varnum*g_stringsize;
|
return AllocStr(g_variables+varnum*g_stringsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setuservariable(int varnum, char *var)
|
void setuservariable(int varnum, char *var)
|
||||||
|
@ -42,15 +58,18 @@ void setuservariable(int varnum, char *var)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int myatoi(char *s)
|
// Updated for int64 and simple bitwise operations
|
||||||
|
__int64 myatoi(char *s)
|
||||||
{
|
{
|
||||||
unsigned int v=0;
|
__int64 v=0;
|
||||||
|
// Check for right input
|
||||||
|
if (!s) return 0;
|
||||||
if (*s == '0' && (s[1] == 'x' || s[1] == 'X'))
|
if (*s == '0' && (s[1] == 'x' || s[1] == 'X'))
|
||||||
{
|
{
|
||||||
s+=2;
|
s++;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
int c=*s++;
|
int c=*(++s);
|
||||||
if (c >= '0' && c <= '9') c-='0';
|
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 if (c >= 'A' && c <= 'F') c-='A'-10;
|
else if (c >= 'A' && c <= 'F') c-='A'-10;
|
||||||
|
@ -61,10 +80,9 @@ int myatoi(char *s)
|
||||||
}
|
}
|
||||||
else if (*s == '0' && s[1] <= '7' && s[1] >= '0')
|
else if (*s == '0' && s[1] <= '7' && s[1] >= '0')
|
||||||
{
|
{
|
||||||
s++;
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
int c=*s++;
|
int c=*(++s);
|
||||||
if (c >= '0' && c <= '7') c-='0';
|
if (c >= '0' && c <= '7') c-='0';
|
||||||
else break;
|
else break;
|
||||||
v<<=3;
|
v<<=3;
|
||||||
|
@ -74,25 +92,52 @@ int myatoi(char *s)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int sign=0;
|
int sign=0;
|
||||||
if (*s == '-') { s++; sign++; }
|
if (*s == '-') sign++; else s--;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
int c=*s++ - '0';
|
int c=*(++s) - '0';
|
||||||
if (c < 0 || c > 9) break;
|
if (c < 0 || c > 9) break;
|
||||||
v*=10;
|
v*=10;
|
||||||
v+=c;
|
v+=c;
|
||||||
}
|
}
|
||||||
if (sign) return -(int) v;
|
if (sign) v = -v;
|
||||||
}
|
}
|
||||||
return (int)v;
|
|
||||||
|
// Support for simple ORed expressions
|
||||||
|
if (*s == '|')
|
||||||
|
{
|
||||||
|
v |= myatoi(s+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
int popint(int *value)
|
void myitoa64(__int64 i, char *buffer)
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buf[128], *b = buf;
|
||||||
if (popstring(buffer) == 0) return FALSE;
|
|
||||||
*value = myatoi(buffer);
|
if (i < 0)
|
||||||
return TRUE;
|
{
|
||||||
|
*(buffer++) = '-';
|
||||||
|
i = -i;
|
||||||
|
}
|
||||||
|
while (i > 0)
|
||||||
|
{
|
||||||
|
*(b++) = '0' + ((char) (i%10));
|
||||||
|
i /= 10;
|
||||||
|
}
|
||||||
|
while (b > buf) *(buffer++) = *(--b);
|
||||||
|
*buffer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int popint()
|
||||||
|
{
|
||||||
|
int value;
|
||||||
|
char *str;
|
||||||
|
if ((str = popstring()) == NULL) return -1;
|
||||||
|
value = (int) myatoi(str);
|
||||||
|
GlobalFree(str);
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushint(int value)
|
void pushint(int value)
|
||||||
|
|
|
@ -36,18 +36,26 @@ __INST_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PLUGINFUNCTION(name) void __declspec(dllexport) name(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) { \
|
#define PLUGINFUNCTION(name) void __declspec(dllexport) name(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) { \
|
||||||
g_hwndParent=hwndParent; \
|
/* g_hwndParent=hwndParent; */\
|
||||||
g_stringsize=string_size; \
|
g_stringsize=string_size; \
|
||||||
g_stacktop=stacktop; \
|
g_stacktop=stacktop; \
|
||||||
g_variables=variables; {
|
g_variables=variables;
|
||||||
#define PLUGINFUNCTIONEND }}
|
#define PLUGINFUNCTIONEND }
|
||||||
|
|
||||||
|
#define PLUGINFUNCTIONSHORT(name) void __declspec(dllexport) name(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) { \
|
||||||
|
g_stringsize=string_size; \
|
||||||
|
g_stacktop=stacktop;
|
||||||
|
#define PLUGINFUNCTIONEND }
|
||||||
|
|
||||||
|
extern char *AllocStr(char *str);
|
||||||
|
extern void myitoa64(__int64 i, char *buffer);
|
||||||
|
extern char *AllocString();
|
||||||
extern char *getuservariable(int varnum);
|
extern char *getuservariable(int varnum);
|
||||||
extern void setuservariable(int varnum, char *var);
|
extern void setuservariable(int varnum, char *var);
|
||||||
extern int popstring(char *str); // 0 on empty stack
|
extern char* popstring(); // NULL - stack empty
|
||||||
extern void pushstring(char *str);
|
extern char* pushstring(char *str);
|
||||||
extern int myatoi(char *s);
|
extern __int64 myatoi(char *s);
|
||||||
extern int popint(int *value); // 0 on empty stack
|
extern int popint(); // -1 -> stack empty
|
||||||
extern void pushint(int value);
|
extern void pushint(int value);
|
||||||
|
|
||||||
extern HWND g_hwndParent;
|
extern HWND g_hwndParent;
|
||||||
|
|
283
Contrib/System/SysFunc.nsh
Normal file
283
Contrib/System/SysFunc.nsh
Normal file
|
@ -0,0 +1,283 @@
|
||||||
|
; Some useful functions based on System plugin
|
||||||
|
;
|
||||||
|
; (c) brainsucker, 2002
|
||||||
|
; (r) BSForce
|
||||||
|
|
||||||
|
!include "${NSISDIR}\Contrib\System\System.nsh"
|
||||||
|
!include "${NSISDIR}\Examples\WinMessages.nsh"
|
||||||
|
|
||||||
|
!define ssName $9
|
||||||
|
!define ssDelay $8
|
||||||
|
!define ssInstance $7
|
||||||
|
!define ssImage $6
|
||||||
|
!define ssWnd $5
|
||||||
|
!define ssResult $4
|
||||||
|
!define ssCallback $3
|
||||||
|
|
||||||
|
Function _systemSplashWndCB
|
||||||
|
; Callback receives 4 values (
|
||||||
|
Pop $R2 ; hwnd
|
||||||
|
Pop $R5 ; umsg
|
||||||
|
Pop $R0 ; wparam
|
||||||
|
Pop $R1 ; lparam
|
||||||
|
|
||||||
|
; Save globals and use them
|
||||||
|
Push $R6
|
||||||
|
Push $R7
|
||||||
|
Push $R8
|
||||||
|
Push $R9
|
||||||
|
Push $2
|
||||||
|
Push $5
|
||||||
|
Push $7
|
||||||
|
Push $9
|
||||||
|
StrCpy $2 $R2
|
||||||
|
StrCpy $5 $R5
|
||||||
|
StrCpy $7 $R0
|
||||||
|
StrCpy $9 $R1
|
||||||
|
|
||||||
|
; MessageBox MB_OK "Got: $2 $5 $7 $9"
|
||||||
|
|
||||||
|
; Message branching
|
||||||
|
IntCmp $5 ${WM_CLOSE} m_Close
|
||||||
|
IntCmp $5 ${WM_TIMER} m_Timer
|
||||||
|
IntCmp $5 ${WM_LBUTTONDOWN} m_Lbtn
|
||||||
|
IntCmp $5 ${WM_CREATE} m_Create
|
||||||
|
IntCmp $5 ${WM_PAINT} m_Paint
|
||||||
|
goto default
|
||||||
|
|
||||||
|
m_Create:
|
||||||
|
|
||||||
|
; Create structures
|
||||||
|
System::Call "*${sysRECT} (_) .R8"
|
||||||
|
System::Call "*${sysBITMAP} (_) .R9"
|
||||||
|
|
||||||
|
; Get bitmap info
|
||||||
|
System::Call "${sysGetObject} (r6, ${sysBITMAP_SIZE}, R9)"
|
||||||
|
|
||||||
|
; Get desktop info
|
||||||
|
System::Call "${sysSystemParametersInfo} (${SPI_GETWORKAREA}, 0, R8, 0)"
|
||||||
|
|
||||||
|
; Style (callbacked)
|
||||||
|
System::Call "${sysSetWindowLong} (r2, ${GWL_STYLE}, 0) .s"
|
||||||
|
!insertmacro SINGLE_CALLBACK 5 $R7 1 _systemSplashWndCB
|
||||||
|
|
||||||
|
; Calculate and set window pos
|
||||||
|
|
||||||
|
; Get bmWidth(R2) and bmHeight(R3)
|
||||||
|
System::Call "*$R9${sysBITMAP} (,.R2,.R3)"
|
||||||
|
; Get left(R4), top(R5), right(R6), bottom(R7)
|
||||||
|
System::Call "*$R8${sysRECT} (.R4,.R5,.R6,.R7)"
|
||||||
|
|
||||||
|
; Left pos
|
||||||
|
IntOp $R0 $R6 - $R4
|
||||||
|
IntOp $R0 $R0 - $R2
|
||||||
|
IntOp $R0 $R0 / 2
|
||||||
|
IntOp $R0 $R0 + $R4
|
||||||
|
|
||||||
|
; Top pos
|
||||||
|
IntOp $R1 $R7 - $R5
|
||||||
|
IntOp $R1 $R1 - $R3
|
||||||
|
IntOp $R1 $R1 / 2
|
||||||
|
IntOp $R1 $R1 + $R5
|
||||||
|
|
||||||
|
System::Call "${sysSetWindowPos} (r2, 0, R0, R1, R2, R3, ${SWP_NOZORDER}) .s"
|
||||||
|
!insertmacro SINGLE_CALLBACK 6 $R7 1 _systemSplashWndCB
|
||||||
|
|
||||||
|
; Show window
|
||||||
|
System::Call "${sysShowWindow} (r2, ${SW_SHOW}) .s"
|
||||||
|
!insertmacro SINGLE_CALLBACK 7 $R7 1 _systemSplashWndCB
|
||||||
|
|
||||||
|
; Set Timer
|
||||||
|
System::Call "${sysSetTimer} (r2, 1, r8,)"
|
||||||
|
|
||||||
|
; Free used memory
|
||||||
|
System::Free $R8
|
||||||
|
System::Free $R9
|
||||||
|
|
||||||
|
StrCpy $R0 0
|
||||||
|
goto exit
|
||||||
|
|
||||||
|
m_Paint:
|
||||||
|
|
||||||
|
; Create structures
|
||||||
|
System::Call "*${sysRECT} (_) .R8"
|
||||||
|
System::Call "*${sysPAINTSTRUCT} (_) .R9"
|
||||||
|
|
||||||
|
; Begin Paint
|
||||||
|
System::Call "${sysBeginPaint} (r2, R9) .R7"
|
||||||
|
|
||||||
|
; CreateCompatibleDC
|
||||||
|
System::Call "${sysCreateCompatibleDC} (R7) .R6"
|
||||||
|
|
||||||
|
; GetClientRect
|
||||||
|
System::Call "${sysGetClientRect} (r2, R8)"
|
||||||
|
|
||||||
|
; Select new bitmap
|
||||||
|
System::Call "${sysSelectObject} (R6, r6) .R5"
|
||||||
|
|
||||||
|
; Get left(R0), top(R1), right(R2), bottom(R3)
|
||||||
|
System::Call "*$R8${sysRECT} (.R0,.R1,.R2,.R3)"
|
||||||
|
|
||||||
|
; width=right-left
|
||||||
|
IntOp $R2 $R2 - $R0
|
||||||
|
; height=bottom-top
|
||||||
|
IntOp $R3 $R3 - $R1
|
||||||
|
|
||||||
|
System::Call "${sysBitBlt} (R7, R0, R1, R2, R3, R6, 0, 0, ${SRCCOPY})"
|
||||||
|
|
||||||
|
; Select old bitmap
|
||||||
|
System::Call "${sysSelectObject} (R6, R5)"
|
||||||
|
|
||||||
|
; Delete compatible DC
|
||||||
|
System::Call "${sysDeleteDC} (R6)"
|
||||||
|
|
||||||
|
; End Paint
|
||||||
|
System::Call "${sysEndPaint} (r2, R9)"
|
||||||
|
|
||||||
|
; Free used memory
|
||||||
|
System::Free $R8
|
||||||
|
System::Free $R9
|
||||||
|
|
||||||
|
StrCpy $R0 0
|
||||||
|
goto exit
|
||||||
|
|
||||||
|
m_Timer:
|
||||||
|
m_Lbtn:
|
||||||
|
StrCpy ${ssResult} 0
|
||||||
|
IntCmp $5 ${WM_TIMER} destroy
|
||||||
|
StrCpy ${ssResult} 1
|
||||||
|
|
||||||
|
destroy:
|
||||||
|
System::Call "${sysDestroyWindow} (r2) .s"
|
||||||
|
!insertmacro SINGLE_CALLBACK 12 $R4 1 _systemSplashWndCB
|
||||||
|
|
||||||
|
default:
|
||||||
|
; Default
|
||||||
|
System::Call "${sysDefWindowProc} (r2, r5, r7, r9) .s"
|
||||||
|
!insertmacro SINGLE_CALLBACK 14 $R0 1 _systemSplashWndCB
|
||||||
|
goto exit
|
||||||
|
|
||||||
|
m_Close:
|
||||||
|
StrCpy $R0 0
|
||||||
|
goto exit
|
||||||
|
|
||||||
|
exit:
|
||||||
|
; Restore globals
|
||||||
|
Pop $9
|
||||||
|
Pop $7
|
||||||
|
Pop $5
|
||||||
|
Pop $2
|
||||||
|
Pop $R9
|
||||||
|
Pop $R8
|
||||||
|
Pop $R7
|
||||||
|
Pop $R6
|
||||||
|
|
||||||
|
; Return from callback
|
||||||
|
System::Call "${ssCallback}" $R0
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function systemSplash
|
||||||
|
Pop $R8
|
||||||
|
Pop $R9
|
||||||
|
|
||||||
|
; Save global register
|
||||||
|
Push $9
|
||||||
|
Push $8
|
||||||
|
Push $7
|
||||||
|
Push $6
|
||||||
|
Push $5
|
||||||
|
Push $4
|
||||||
|
Push $3
|
||||||
|
|
||||||
|
StrCpy ${ssName} $R9
|
||||||
|
StrCpy ${ssDelay} $R8
|
||||||
|
|
||||||
|
; Get module instance
|
||||||
|
System::Call "${sysGetModuleHandle} (i) .r7"
|
||||||
|
; Pop ${ssInstance}
|
||||||
|
|
||||||
|
; Get arrow cursor
|
||||||
|
System::Call "${sysLoadCursor} (0, i ${IDC_ARROW}) .R9"
|
||||||
|
; Pop $R9
|
||||||
|
|
||||||
|
; Get callback
|
||||||
|
System::Get "${sysWNDPROC}"
|
||||||
|
Pop ${ssCallback}
|
||||||
|
|
||||||
|
; Create window class
|
||||||
|
System::Call "*${sysWNDCLASS} (,r3,,,r7,,R9,,,s) .R9" "_sp"
|
||||||
|
; Pop $R9
|
||||||
|
|
||||||
|
; Register window class
|
||||||
|
System::Call "${sysRegisterClass} (R9) .R9"
|
||||||
|
IntCmp $R9 0 errorexit ; Class registered ok?
|
||||||
|
|
||||||
|
; Load Image (LR_CREATEDIBSECTION|LR_LOADFROMFILE = 0x2010)
|
||||||
|
System::Call '${sysLoadImage} (, s, ${IMAGE_BITMAP}, 0, 0, ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) .r6' "${ssName}.bmp"
|
||||||
|
; Pop ${ssImage}
|
||||||
|
IntCmp ${ssImage} 0 errorexit ; Image loaded ok?
|
||||||
|
|
||||||
|
; Start the sound (SND_ASYNC|SND_FILENAME|SND_NODEFAULT = 0x20003)
|
||||||
|
System::Call "${sysPlaySound} (s,,${SND_ASYNC}|${SND_FILENAME}|${SND_NODEFAULT})" "${ssName}.wav"
|
||||||
|
|
||||||
|
; Create window
|
||||||
|
System::Call "${sysCreateWindowEx} (${WS_EX_TOOLWINDOW}, s, s,,,,,, $HWNDPARENT,,r7,) .s" "_sp" "_sp"
|
||||||
|
; Pop ${ssWnd} -> SINGLE_CALLBACK will do that
|
||||||
|
!insertmacro SINGLE_CALLBACK 1 ${ssWnd} 1 _systemSplashWndCB
|
||||||
|
|
||||||
|
; Create MSG struct
|
||||||
|
System::Call "*${sysMSG} (_) i.R9"
|
||||||
|
; Pop $R9
|
||||||
|
|
||||||
|
; -------------------------
|
||||||
|
repeat:
|
||||||
|
; Check for window
|
||||||
|
System::Call "${sysIsWindow} (r5) .s"
|
||||||
|
!insertmacro SINGLE_CALLBACK 2 $R8 1 _systemSplashWndCB
|
||||||
|
IntCmp $R8 0 finish
|
||||||
|
|
||||||
|
; Get message
|
||||||
|
System::Call "${sysGetMessage} (R9, r5,_) .s"
|
||||||
|
!insertmacro SINGLE_CALLBACK 3 $R8 1 _systemSplashWndCB
|
||||||
|
IntCmp $R8 0 finish
|
||||||
|
|
||||||
|
; Dispatch message
|
||||||
|
System::Call "${sysDispatchMessage} (R9) .s"
|
||||||
|
!insertmacro SINGLE_CALLBACK 4 $R8 1 _systemSplashWndCB
|
||||||
|
|
||||||
|
; Repeat dispatch cycle
|
||||||
|
goto repeat
|
||||||
|
; -------------------------
|
||||||
|
|
||||||
|
finish:
|
||||||
|
; Stop the sound
|
||||||
|
System::Call "${sysPlaySound}"
|
||||||
|
|
||||||
|
; Delete bitmap object
|
||||||
|
System::Call "${sysDeleteObject} (r6)"
|
||||||
|
|
||||||
|
; Delete the callback queue
|
||||||
|
System::Free /CALLBACK ${ssCallback}
|
||||||
|
|
||||||
|
; Dialog return
|
||||||
|
StrCpy $R0 ${ssResult}
|
||||||
|
goto exit
|
||||||
|
|
||||||
|
; Exit in case of error
|
||||||
|
errorexit:
|
||||||
|
StrCpy $R0 -1
|
||||||
|
goto exit
|
||||||
|
|
||||||
|
exit:
|
||||||
|
; Restore globals
|
||||||
|
Pop $3
|
||||||
|
Pop $4
|
||||||
|
Pop $5
|
||||||
|
Pop $6
|
||||||
|
Pop $7
|
||||||
|
Pop $8
|
||||||
|
Pop $9
|
||||||
|
|
||||||
|
; Return
|
||||||
|
Push $R0
|
||||||
|
FunctionEnd
|
File diff suppressed because it is too large
Load diff
|
@ -12,39 +12,83 @@
|
||||||
#define SYSTEM_API __declspec(dllimport)
|
#define SYSTEM_API __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Real world types
|
#define NEW_STACK_SIZE 65536
|
||||||
#define PT_VOID 0
|
|
||||||
#define PT_INT 1
|
// Proc types:
|
||||||
#define PT_LONG 2
|
#define PT_NOTHING 0
|
||||||
#define PT_STRING 3
|
#define PT_PROC 1
|
||||||
#define PT_BOOLEAN 4
|
#define PT_STRUCT 2
|
||||||
|
|
||||||
|
// Proc results:
|
||||||
|
#define PR_OK 0
|
||||||
|
#define PR_ERROR -1
|
||||||
|
#define PR_CALLBACK 1
|
||||||
|
|
||||||
|
// Real world argument types
|
||||||
|
#define PAT_VOID 0
|
||||||
|
#define PAT_INT 1
|
||||||
|
#define PAT_LONG 2
|
||||||
|
#define PAT_STRING 3
|
||||||
|
#define PAT_BOOLEAN 4
|
||||||
|
#define PAT_CALLBACK 5
|
||||||
|
|
||||||
// Input/Output Source/Destination
|
// Input/Output Source/Destination
|
||||||
#define IOT_NONE 0
|
#define IOT_NONE 0
|
||||||
#define IOT_STACK -1
|
#define IOT_STACK -1
|
||||||
#define IOT_REG 1
|
#define IOT_REG 1
|
||||||
|
// #define INLINE_INPUT -> any other value, will contain pointer to input string
|
||||||
|
|
||||||
|
// Options
|
||||||
|
#define POPT_CDECL 0x1 // (Option & 0x1) == 0x1 -> cdecl, otherwise stdcall
|
||||||
|
#define POPT_PERMANENT 0x2 // Permanent proc, will not be destroyed after calling
|
||||||
|
#define POPT_ALWRETURN 0x4 // Always return
|
||||||
|
#define POPT_NEVERREDEF 0x8 // Never redefine
|
||||||
|
#define POPT_GENSTACK 0x10 // Use general stack (non temporary for callback)
|
||||||
|
#define POPT_CLONE 0x20 // This is clone callback
|
||||||
|
|
||||||
// Our single proc parameter
|
// Our single proc parameter
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int Type;
|
int Type;
|
||||||
BOOL IsPointer;
|
int Option; // -1 -> Pointer, 1-... -> Special
|
||||||
int Value; // it can hold any value
|
int Value; // it can hold any 4 byte value
|
||||||
|
int _value; // value buffer for structures > 4 bytes (I hope 8 bytes will be enough)
|
||||||
|
int Size; // Value real size (should be either 1 or 2 (the number of pushes))
|
||||||
int Input;
|
int Input;
|
||||||
int Output;
|
int Output;
|
||||||
} ProcParameter;
|
} ProcParameter;
|
||||||
|
|
||||||
// Our single proc
|
// Our single proc (Since the user will free proc with GlobalFree,
|
||||||
typedef struct
|
// I've declared all variables as statics)
|
||||||
|
typedef struct tag_SystemProc SystemProc;
|
||||||
|
typedef struct tag_SystemProc
|
||||||
{
|
{
|
||||||
HANDLE dll;
|
int ProcType;
|
||||||
HANDLE proc;
|
int ProcResult;
|
||||||
|
char DllName[1024];
|
||||||
|
char ProcName[1024];
|
||||||
|
HANDLE Dll;
|
||||||
|
HANDLE Proc;
|
||||||
|
int Options;
|
||||||
int ParamCount;
|
int ParamCount;
|
||||||
ProcParameter Params[20]; // I hope nobody will use more than 20 params
|
ProcParameter Params[100]; // I hope nobody will use more than 100 params
|
||||||
|
|
||||||
|
// Callback specific
|
||||||
|
int CallbackIndex;
|
||||||
|
int ArgsSize;
|
||||||
|
// Clone of current element (used for multi-level callbacks)
|
||||||
|
SystemProc *Clone;
|
||||||
} SystemProc;
|
} SystemProc;
|
||||||
|
|
||||||
extern SystemProc *ParseProc(char *ProcID);
|
extern int ParamSizeByType[]; // Size of every parameter type (*4 bytes)
|
||||||
extern BOOL ParseParam(SystemProc *proc, char *ParamID);
|
|
||||||
extern void ParamsInput(SystemProc *proc);
|
extern HANDLE CreateCallback(SystemProc *cbproc);
|
||||||
extern void ParamsOutput(SystemProc *proc);
|
extern SystemProc *PrepareProc();
|
||||||
extern void SystemCall(SystemProc *proc);
|
extern void ParamAllocate(SystemProc *proc);
|
||||||
|
extern void ParamsDeAllocate(SystemProc *proc);
|
||||||
|
extern void ParamsIn(SystemProc *proc);
|
||||||
|
extern void ParamsOut(SystemProc *proc);
|
||||||
|
extern SystemProc *CallProc(SystemProc *proc);
|
||||||
|
extern SystemProc *CallBack(SystemProc *proc);
|
||||||
|
extern SystemProc *RealCallBack();
|
||||||
|
extern void CallStruct(SystemProc *proc);
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Microsoft C/C++ MSF 7.00
|
|
353
Contrib/System/System.nsh
Normal file
353
Contrib/System/System.nsh
Normal file
|
@ -0,0 +1,353 @@
|
||||||
|
; Some useful functions, structures, constants
|
||||||
|
;
|
||||||
|
; (c) brainsucker, 2002
|
||||||
|
; (r) BSForce
|
||||||
|
|
||||||
|
; Check for double includes
|
||||||
|
!ifndef System.NSH.Included
|
||||||
|
|
||||||
|
!define System.NSH.Included
|
||||||
|
|
||||||
|
; ------------- Functions --------------
|
||||||
|
|
||||||
|
; LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
!define sysWNDPROC "(i.s, i.s, i.s, i.s) iss"
|
||||||
|
|
||||||
|
; LRESULT DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
!define sysDefWindowProc "user32::DefWindowProcA(i, i, i, i) i"
|
||||||
|
|
||||||
|
!define sysMessageBox "user32::MessageBoxA(i, t, t, i) i"
|
||||||
|
|
||||||
|
; int wsprintf(LPTSTR lpOut, LPCTSTR lpFmt, ...);
|
||||||
|
!define syswsprintf "user32::wsprintfA(t, t) i ? c"
|
||||||
|
|
||||||
|
; HMODULE GetModuleHandle(LPCTSTR lpModuleName);
|
||||||
|
!define sysGetModuleHandle "kernel32::GetModuleHandleA(t) i"
|
||||||
|
|
||||||
|
; HCURSOR LoadCursor(HINSTANCE hInstance, LPCTSTR lpCursorName);
|
||||||
|
!define sysLoadCursor "user32::LoadCursorA(i, t) i"
|
||||||
|
|
||||||
|
; ATOM RegisterClass(CONST WNDCLASS *lpWndClass);
|
||||||
|
!define sysRegisterClass "user32::RegisterClassA(i) i"
|
||||||
|
|
||||||
|
; HANDLE LoadImage(HINSTANCE hinst, LPCTSTR lpszName, UINT uType,
|
||||||
|
; int cxDesired, int cyDesired, UINT fuLoad);
|
||||||
|
!define sysLoadImage "user32::LoadImageA(i, t, i, i, i, i) i"
|
||||||
|
|
||||||
|
; BOOL PlaySound(LPCSTR pszSound, HMODULE hmod, DWORD fdwSound);
|
||||||
|
!define sysPlaySound "winmm.dll::PlaySoundA(t, i, i) i"
|
||||||
|
|
||||||
|
; HWND CreateWindowEx(DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName,
|
||||||
|
; DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent,
|
||||||
|
; HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
|
||||||
|
!define sysCreateWindowEx "user32::CreateWindowExA(i, t, t, i, i, i, i, i, i, i, i, i) i"
|
||||||
|
|
||||||
|
; BOOL IsWindow(HWND hWnd);
|
||||||
|
!define sysIsWindow "user32::IsWindow(i) i"
|
||||||
|
|
||||||
|
; LONG SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong);
|
||||||
|
!define sysSetWindowLong "user32::SetWindowLongA(i, i, i) i"
|
||||||
|
|
||||||
|
; BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
|
||||||
|
!define sysSetWindowPos "user32::SetWindowPos(i, i, i, i, i, i, i) i"
|
||||||
|
|
||||||
|
; BOOL ShowWindow(HWND hWnd, int nCmdShow);
|
||||||
|
!define sysShowWindow "user32::ShowWindow(i, i) i"
|
||||||
|
|
||||||
|
; BOOL DestroyWindow(HWND hWnd);
|
||||||
|
!define sysDestroyWindow "user32::DestroyWindow(i) i"
|
||||||
|
|
||||||
|
; BOOL GetClientRect(HWND hWnd, LPRECT lpRect);
|
||||||
|
!define sysGetClientRect "user32::GetClientRect(i, i) i"
|
||||||
|
|
||||||
|
; BOOL GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax);
|
||||||
|
!define sysGetMessage "user32::GetMessageA(i, i, i, i) i"
|
||||||
|
|
||||||
|
; LRESULT DispatchMessage(CONST MSG *lpmsg);
|
||||||
|
!define sysDispatchMessage "user32::DispatchMessageA(i) i"
|
||||||
|
|
||||||
|
; BOOL DeleteObject(HGDIOBJ hObject);
|
||||||
|
!define sysDeleteObject "gdi32::DeleteObject(i) i"
|
||||||
|
|
||||||
|
; int GetObject(HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject);
|
||||||
|
!define sysGetObject "gdi32::GetObjectA(i, i, i) i"
|
||||||
|
|
||||||
|
; HGDIOBJ SelectObject(HDC hdc, HGDIOBJ hgdiobj);
|
||||||
|
!define sysSelectObject "gdi32::SelectObject(i, i) i"
|
||||||
|
|
||||||
|
; HDC CreateCompatibleDC(HDC hdc);
|
||||||
|
!define sysCreateCompatibleDC "gdi32::CreateCompatibleDC(i) i"
|
||||||
|
|
||||||
|
; BOOL DeleteDC(HDC hdc);
|
||||||
|
!define sysDeleteDC "gdi32::DeleteDC(i) i"
|
||||||
|
|
||||||
|
; BOOL BitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
|
||||||
|
; HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop);
|
||||||
|
!define sysBitBlt "gdi32::BitBlt(i, i, i, i, i, i, i, i, i) i"
|
||||||
|
|
||||||
|
; HDC BeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint);
|
||||||
|
!define sysBeginPaint "user32::BeginPaint(i, i) i"
|
||||||
|
|
||||||
|
; BOOL EndPaint(HWND hWnd, CONST PAINTSTRUCT *lpPaint);
|
||||||
|
!define sysEndPaint "user32::EndPaint(i, i) i"
|
||||||
|
|
||||||
|
; BOOL SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
|
||||||
|
!define sysSystemParametersInfo "user32::SystemParametersInfoA(i, i, i, i) i"
|
||||||
|
|
||||||
|
; UINT_PTR SetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc);
|
||||||
|
!define sysSetTimer "user32::SetTimer(i, i, i, k) i"
|
||||||
|
|
||||||
|
|
||||||
|
; ------------- Structures --------------
|
||||||
|
|
||||||
|
; typedef struct _WNDCLASS {
|
||||||
|
; UINT style;
|
||||||
|
; WNDPROC lpfnWndProc;
|
||||||
|
; int cbClsExtra;
|
||||||
|
; int cbWndExtra;
|
||||||
|
; HINSTANCE hInstance;
|
||||||
|
; HICON hIcon;
|
||||||
|
; HCURSOR hCursor;
|
||||||
|
; HBRUSH hbrBackground;
|
||||||
|
; LPCTSTR lpszMenuName;
|
||||||
|
; LPCTSTR lpszClassName;
|
||||||
|
; } WNDCLASS, *PWNDCLASS;
|
||||||
|
!define sysWNDCLASS "(i, k, i, i, i, i, i, i, t, t) i"
|
||||||
|
|
||||||
|
; typedef struct tagMSG {
|
||||||
|
; HWND hwnd;
|
||||||
|
; UINT message;
|
||||||
|
; WPARAM wParam;
|
||||||
|
; LPARAM lParam;
|
||||||
|
; DWORD time;
|
||||||
|
; POINT pt; -> will be presented as two separate px and py
|
||||||
|
; } MSG, *PMSG;
|
||||||
|
!define sysMSG "(i, i, i, i, i, i, i) i"
|
||||||
|
|
||||||
|
; typedef struct tagBITMAP {
|
||||||
|
; LONG bmType;
|
||||||
|
; LONG bmWidth;
|
||||||
|
; LONG bmHeight;
|
||||||
|
; LONG bmWidthBytes;
|
||||||
|
; WORD bmPlanes;
|
||||||
|
; WORD bmBitsPixel;
|
||||||
|
; LPVOID bmBits;
|
||||||
|
; } BITMAP, *PBITMAP;
|
||||||
|
!define sysBITMAP "(i, i, i, i, i, i, i) i"
|
||||||
|
!define sysBITMAP_SIZE 28
|
||||||
|
|
||||||
|
; typedef struct _RECT {
|
||||||
|
; LONG left;
|
||||||
|
; LONG top;
|
||||||
|
; LONG right;
|
||||||
|
; LONG bottom;
|
||||||
|
; } RECT, *PRECT;
|
||||||
|
!define sysRECT "(i, i, i, i) i"
|
||||||
|
|
||||||
|
; typedef struct tagPAINTSTRUCT {
|
||||||
|
; HDC hdc;
|
||||||
|
; BOOL fErase;
|
||||||
|
; RECT rcPaint; (rcl, rct, rcr, rcb)
|
||||||
|
; BOOL fRestore;
|
||||||
|
; BOOL fIncUpdate;
|
||||||
|
; BYTE rgbReserved[32];
|
||||||
|
; } PAINTSTRUCT, *PPAINTSTRUCT;
|
||||||
|
!define sysPAINTSTRUCT "(i, i, i, i, i, i, i, i, &v32) i"
|
||||||
|
|
||||||
|
; ------------- Constants --------------
|
||||||
|
|
||||||
|
; == Cursors ==
|
||||||
|
|
||||||
|
!define IDC_ARROW 32512
|
||||||
|
!define IDC_IBEAM 32513
|
||||||
|
!define IDC_WAIT 32514
|
||||||
|
!define IDC_CROSS 32515
|
||||||
|
!define IDC_UPARROW 32516
|
||||||
|
!define IDC_SIZE 32640
|
||||||
|
!define IDC_ICON 32641
|
||||||
|
!define IDC_SIZENWSE 32642
|
||||||
|
!define IDC_SIZENESW 32643
|
||||||
|
!define IDC_SIZEWE 32644
|
||||||
|
!define IDC_SIZENS 32645
|
||||||
|
!define IDC_SIZEALL 32646
|
||||||
|
!define IDC_NO 32648
|
||||||
|
!define IDC_HAND 32649
|
||||||
|
!define IDC_APPSTARTING 32650
|
||||||
|
!define IDC_HELP 32651
|
||||||
|
|
||||||
|
; == Images ==
|
||||||
|
|
||||||
|
!define IMAGE_BITMAP 0
|
||||||
|
!define IMAGE_ICON 1
|
||||||
|
!define IMAGE_CURSOR 2
|
||||||
|
!define IMAGE_ENHMETAFILE 3
|
||||||
|
|
||||||
|
!define LR_DEFAULTCOLOR 0x0000
|
||||||
|
!define LR_MONOCHROME 0x0001
|
||||||
|
!define LR_COLOR 0x0002
|
||||||
|
!define LR_COPYRETURNORG 0x0004
|
||||||
|
!define LR_COPYDELETEORG 0x0008
|
||||||
|
!define LR_LOADFROMFILE 0x0010
|
||||||
|
!define LR_LOADTRANSPARENT 0x0020
|
||||||
|
!define LR_DEFAULTSIZE 0x0040
|
||||||
|
!define LR_VGACOLOR 0x0080
|
||||||
|
!define LR_LOADMAP3DCOLORS 0x1000
|
||||||
|
!define LR_CREATEDIBSECTION 0x2000
|
||||||
|
!define LR_COPYFROMRESOURCE 0x4000
|
||||||
|
!define LR_SHARED 0x8000
|
||||||
|
|
||||||
|
; == Sounds ==
|
||||||
|
|
||||||
|
!define SND_SYNC 0x0000
|
||||||
|
!define SND_ASYNC 0x0001
|
||||||
|
!define SND_NODEFAULT 0x0002
|
||||||
|
!define SND_MEMORY 0x0004
|
||||||
|
!define SND_LOOP 0x0008
|
||||||
|
!define SND_NOSTOP 0x0010
|
||||||
|
|
||||||
|
!define SND_NOWAIT 0x00002000
|
||||||
|
!define SND_ALIAS 0x00010000
|
||||||
|
!define SND_ALIAS_ID 0x00110000
|
||||||
|
!define SND_FILENAME 0x00020000
|
||||||
|
!define SND_RESOURCE 0x00040004
|
||||||
|
!define SND_PURGE 0x0040
|
||||||
|
!define SND_APPLICATION 0x0080
|
||||||
|
|
||||||
|
; == Windows ==
|
||||||
|
|
||||||
|
!define WS_OVERLAPPED 0x00000000
|
||||||
|
!define WS_POPUP 0x80000000
|
||||||
|
!define WS_CHILD 0x40000000
|
||||||
|
!define WS_MINIMIZE 0x20000000
|
||||||
|
!define WS_VISIBLE 0x10000000
|
||||||
|
!define WS_DISABLED 0x08000000
|
||||||
|
!define WS_CLIPSIBLINGS 0x04000000
|
||||||
|
!define WS_CLIPCHILDREN 0x02000000
|
||||||
|
!define WS_MAXIMIZE 0x01000000
|
||||||
|
!define WS_CAPTION 0x00C00000
|
||||||
|
!define WS_BORDER 0x00800000
|
||||||
|
!define WS_DLGFRAME 0x00400000
|
||||||
|
!define WS_VSCROLL 0x00200000
|
||||||
|
!define WS_HSCROLL 0x00100000
|
||||||
|
!define WS_SYSMENU 0x00080000
|
||||||
|
!define WS_THICKFRAME 0x00040000
|
||||||
|
!define WS_GROUP 0x00020000
|
||||||
|
!define WS_TABSTOP 0x00010000
|
||||||
|
!define WS_MINIMIZEBOX 0x00020000
|
||||||
|
!define WS_MAXIMIZEBOX 0x00010000
|
||||||
|
!define WS_TILED ${WS_OVERLAPPED}
|
||||||
|
!define WS_ICONIC ${WS_MINIMIZE}
|
||||||
|
!define WS_SIZEBOX ${WS_THICKFRAME}
|
||||||
|
!define WS_OVERLAPPEDWINDOW 0x00CF0000
|
||||||
|
!define WS_TILEDWINDOW ${WS_OVERLAPPEDWINDOW}
|
||||||
|
!define WS_POPUPWINDOW 0x80880000
|
||||||
|
!define WS_CHILDWINDOW ${WS_CHILD}
|
||||||
|
!define WS_EX_DLGMODALFRAME 0x00000001
|
||||||
|
!define WS_EX_NOPARENTNOTIFY 0x00000004
|
||||||
|
!define WS_EX_TOPMOST 0x00000008
|
||||||
|
!define WS_EX_ACCEPTFILES 0x00000010
|
||||||
|
!define WS_EX_TRANSPARENT 0x00000020
|
||||||
|
!define WS_EX_MDICHILD 0x00000040
|
||||||
|
!define WS_EX_TOOLWINDOW 0x00000080
|
||||||
|
!define WS_EX_WINDOWEDGE 0x00000100
|
||||||
|
!define WS_EX_CLIENTEDGE 0x00000200
|
||||||
|
!define WS_EX_CONTEXTHELP 0x00000400
|
||||||
|
!define WS_EX_RIGHT 0x00001000
|
||||||
|
!define WS_EX_LEFT 0x00000000
|
||||||
|
!define WS_EX_RTLREADING 0x00002000
|
||||||
|
!define WS_EX_LTRREADING 0x00000000
|
||||||
|
!define WS_EX_LEFTSCROLLBAR 0x00004000
|
||||||
|
!define WS_EX_RIGHTSCROLLBAR 0x00000000
|
||||||
|
!define WS_EX_CONTROLPARENT 0x00010000
|
||||||
|
!define WS_EX_STATICEDGE 0x00020000
|
||||||
|
!define WS_EX_APPWINDOW 0x00040000
|
||||||
|
!define WS_EX_OVERLAPPEDWINDOW 0x00000300
|
||||||
|
!define WS_EX_PALETTEWINDOW 0x00000188
|
||||||
|
!define WS_EX_LAYERED 0x00080000
|
||||||
|
!define WS_EX_NOINHERITLAYOUT 0x00100000
|
||||||
|
!define WS_EX_LAYOUTRTL 0x00400000
|
||||||
|
!define WS_EX_COMPOSITED 0x02000000
|
||||||
|
!define WS_EX_NOACTIVATE 0x08000000
|
||||||
|
|
||||||
|
|
||||||
|
; == System Parameters Info ==
|
||||||
|
|
||||||
|
!define SPI_GETWORKAREA 0x0030
|
||||||
|
|
||||||
|
; == Window Long Offsets ==
|
||||||
|
|
||||||
|
!define GWL_WNDPROC -4
|
||||||
|
!define GWL_HINSTANCE -6
|
||||||
|
!define GWL_HWNDPARENT -8
|
||||||
|
!define GWL_STYLE -16
|
||||||
|
!define GWL_EXSTYLE -20
|
||||||
|
!define GWL_USERDATA -21
|
||||||
|
!define GWL_ID -12
|
||||||
|
|
||||||
|
; == Show Window ==
|
||||||
|
|
||||||
|
!define SW_HIDE 0
|
||||||
|
!define SW_SHOWNORMAL 1
|
||||||
|
!define SW_NORMAL 1
|
||||||
|
!define SW_SHOWMINIMIZED 2
|
||||||
|
!define SW_SHOWMAXIMIZED 3
|
||||||
|
!define SW_MAXIMIZE 3
|
||||||
|
!define SW_SHOWNOACTIVATE 4
|
||||||
|
!define SW_SHOW 5
|
||||||
|
!define SW_MINIMIZE 6
|
||||||
|
!define SW_SHOWMINNOACTIVE 7
|
||||||
|
!define SW_SHOWNA 8
|
||||||
|
!define SW_RESTORE 9
|
||||||
|
!define SW_SHOWDEFAULT 10
|
||||||
|
!define SW_FORCEMINIMIZE 11
|
||||||
|
!define SW_MAX 11
|
||||||
|
|
||||||
|
; == Window swap ==
|
||||||
|
|
||||||
|
!define SWP_NOSIZE 0x0001
|
||||||
|
!define SWP_NOMOVE 0x0002
|
||||||
|
!define SWP_NOZORDER 0x0004
|
||||||
|
!define SWP_NOREDRAW 0x0008
|
||||||
|
!define SWP_NOACTIVATE 0x0010
|
||||||
|
!define SWP_FRAMECHANGED 0x0020
|
||||||
|
!define SWP_SHOWWINDOW 0x0040
|
||||||
|
!define SWP_HIDEWINDOW 0x0080
|
||||||
|
!define SWP_NOCOPYBITS 0x0100
|
||||||
|
!define SWP_NOOWNERZORDER 0x0200
|
||||||
|
!define SWP_NOSENDCHANGING 0x0400
|
||||||
|
|
||||||
|
!define SWP_DRAWFRAME ${SWP_FRAMECHANGED}
|
||||||
|
!define SWP_NOREPOSITION ${SWP_NOOWNERZORDER}
|
||||||
|
!define SWP_DEFERERASE 0x2000
|
||||||
|
!define SWP_ASYNCWINDOWPOS 0x4000
|
||||||
|
|
||||||
|
; == Bit Copy ==
|
||||||
|
|
||||||
|
!define SRCCOPY 0x00CC0020
|
||||||
|
!define SRCPAINT 0x00EE0086
|
||||||
|
!define SRCAND 0x008800C6
|
||||||
|
!define SRCINVERT 0x00660046
|
||||||
|
!define SRCERASE 0x00440328
|
||||||
|
!define NOTSRCCOPY 0x00330008
|
||||||
|
!define NOTSRCERASE 0x001100A6
|
||||||
|
!define MERGECOPY 0x00C000CA
|
||||||
|
!define MERGEPAINT 0x00BB0226
|
||||||
|
!define PATCOPY 0x00F00021
|
||||||
|
!define PATPAINT 0x00FB0A09
|
||||||
|
!define PATINVERT 0x005A0049
|
||||||
|
!define DSTINVERT 0x00550009
|
||||||
|
!define BLACKNESS 0x00000042
|
||||||
|
!define WHITENESS 0x00FF0062
|
||||||
|
|
||||||
|
; == Callbacks ==
|
||||||
|
|
||||||
|
!macro SINGLE_CALLBACK CHKN RES INDEX FUNC
|
||||||
|
CheckCB_${CHKN}:
|
||||||
|
Pop ${RES}
|
||||||
|
StrCmp ${RES} "callback${INDEX}" 0 ExitCB_${CHKN}
|
||||||
|
Call ${FUNC}
|
||||||
|
Goto CheckCB_${CHKN}
|
||||||
|
ExitCB_${CHKN}:
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!endif
|
|
@ -1,163 +0,0 @@
|
||||||
System: NSIS Plugin
|
|
||||||
|
|
||||||
* - I'm a lazy bitch, for *(N) - see comment N at the end of the file.
|
|
||||||
|
|
||||||
I. Introduction.
|
|
||||||
----------------
|
|
||||||
|
|
||||||
That plugin will make you virtually unstopable. Now you could call any
|
|
||||||
DLL procedure or function, i.e. you gain full control over the system.
|
|
||||||
|
|
||||||
If you want to call some proc, you should prepare two proc IDs: the
|
|
||||||
ProcId and ParamID. Since the System plugin couldn't know the dll proc
|
|
||||||
parameters and return type, you should find the proc description somewhere (the
|
|
||||||
best will be .h files, for example from Platform SDK in case of system dlls).
|
|
||||||
After that you should specify the ProcID: it contains the DLL and proc name,
|
|
||||||
proc parameters, and proc calling options.
|
|
||||||
Since the parameters format of proc in DLL never changes (in general),
|
|
||||||
that ProcID can be defined ones for all times (in include file for example, and
|
|
||||||
I'm thinking about automatic conversion of some windows headers (winbase.h,
|
|
||||||
winuser.h ...) to ProcID defines).
|
|
||||||
|
|
||||||
When you want to call the proc, you should prepare the second id,
|
|
||||||
ParamID. It specifies where the System plugin should find your input values
|
|
||||||
(registers, stack, etc) and where it should place proc output values. You can
|
|
||||||
define this id once for installation, or you can use separate declaration at
|
|
||||||
each call.
|
|
||||||
|
|
||||||
II. ProcID.
|
|
||||||
-----------
|
|
||||||
|
|
||||||
Ok. Let's learn how to convert function declaration to ProcID. Below
|
|
||||||
the ProcID format is specified (You can read here *(1) why I'm using '?' as
|
|
||||||
delimeter):
|
|
||||||
|
|
||||||
"dll?proc?params?options", where:
|
|
||||||
|
|
||||||
- dll - the path (or name) of DLL containing proc (for ex: "kernel32",
|
|
||||||
"c:\test\super.dll", etc.).
|
|
||||||
- proc - the proc name itself (warning: the proc name must be specified
|
|
||||||
in the way it mentioned at dll, for example it may look like "_MyFunction@16".
|
|
||||||
Other examples: "GetDiskFreeSpaceExA", "GetProcAddress", etc.).
|
|
||||||
- params - the proc parameters, described below.
|
|
||||||
- options - the proc options *(2) (for those, who don't want to read my
|
|
||||||
comments - Currently Unavailable). At least two will be defined later: 'c' & 's'
|
|
||||||
-> CDECL and STDCALL calling conventions. Should be completly (including
|
|
||||||
question mark) ommited now.
|
|
||||||
|
|
||||||
Ok, each proc parameter (and return) is presented by single chararacter
|
|
||||||
(there is only one exception - p character), these character are:
|
|
||||||
|
|
||||||
v - void (generaly for return)
|
|
||||||
i - int (includes char, byte, short, handles, pointers and so on)
|
|
||||||
l - long & large integer (know as int64)
|
|
||||||
s - string (LPCSTR, pointer to first character)
|
|
||||||
b - boolean (needs/returns 'true':'false') - by the fact this type is
|
|
||||||
senseless -> usual integer can be used ('0':'1')
|
|
||||||
|
|
||||||
p - pointer specifier -> the proc needs the pointer to type, affects
|
|
||||||
next char (parameter) [ex: 'pi' - pointer to int]
|
|
||||||
|
|
||||||
Huh, I think that is easily understandable, but there is one IMPORTANT
|
|
||||||
HINT: the first parameter is RETURN type!
|
|
||||||
And at last: the pointers. You should remember that if you specify
|
|
||||||
pointer parameter with 'p' specifier, the System Plugin waits from you and will
|
|
||||||
return to you BASE TYPE, i.e. for 'pi' it will wait for and return to you
|
|
||||||
INTEGER.
|
|
||||||
As I wrote above the options (including calling conventions are
|
|
||||||
unsupported now), the System Plugin will always call DLL function with STDCALL
|
|
||||||
(this convention is default for windows procs, for example for procs specified
|
|
||||||
with WINAPI. CDECL is usually used with WINAPIV declared procs. This V char
|
|
||||||
stands for variable, or arguments-list -> with CDECL convention the stack after
|
|
||||||
the function call is cleared by caller, and with STDCALL it is cleared by called
|
|
||||||
proc ('calee') -> all procs with arguments-lists (such as wsprintf) must use
|
|
||||||
CDECL).
|
|
||||||
|
|
||||||
IIa. ProcID examples.
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
Let's transform some real procs defenitions to ProcIDs:
|
|
||||||
|
|
||||||
1) WINBASEAPI FARPROC WINAPI GetProcAddress(IN HMODULE hModule,
|
|
||||||
IN LPCSTR lpProcName);
|
|
||||||
For the start: proc defined with WINAPI - stdcall and thats allright.
|
|
||||||
Proc return type FARPROC is just another name for proc handle (or address), so
|
|
||||||
we could use integer type. This proc defined at kernel32.dll, but '.dll' could
|
|
||||||
be ommited. So...
|
|
||||||
|
|
||||||
"kernel32?GetProcAddress?iis"
|
|
||||||
|
|
||||||
Params: i - return, i - hModule, s - lpProcName.
|
|
||||||
Simple, huh?
|
|
||||||
|
|
||||||
2) WINBASEAPI BOOL WINAPI GetDiskFreeSpaceExA( IN LPCSTR lpDirectoryName,
|
|
||||||
OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller,
|
|
||||||
OUT PULARGE_INTEGER lpTotalNumberOfBytes,
|
|
||||||
OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes
|
|
||||||
);
|
|
||||||
|
|
||||||
At first, If you'll look at MSDN, you will find GetDiskFreeSpaceEx
|
|
||||||
function, but not with trailing 'A'. This is default Microsoft behaviour for
|
|
||||||
functions, which have two variants: for ANSI (trailing 'A') and UNICODE
|
|
||||||
(trailing 'W') respectively. You can meet such functions sometimes, and since
|
|
||||||
neither NSIS or System Plugin support unicode you should always use version with
|
|
||||||
trailing 'A'. PULARGE_INTEGER can be represented as (int64*) [pointer to long],
|
|
||||||
so we will code this ProcID as:
|
|
||||||
|
|
||||||
"kernel32.dll?GetDiskFreeSpaceExA?bsplplpl"
|
|
||||||
|
|
||||||
Params: b - return (boolean); pl, pl, pl - three pointer to long.
|
|
||||||
|
|
||||||
See other examples at System.nsh.
|
|
||||||
|
|
||||||
III. ParamID.
|
|
||||||
-------------
|
|
||||||
|
|
||||||
Ok, here is ParamID format:
|
|
||||||
|
|
||||||
"input?output"
|
|
||||||
|
|
||||||
Input/Output -> describes places (from where to take and where to put), encoded
|
|
||||||
by single character too. The first character of output describes the place for
|
|
||||||
function return.
|
|
||||||
|
|
||||||
Input sources / Output destinations:
|
|
||||||
Registers $0-$9 -> 0..9
|
|
||||||
Registers $R0-$R9 -> a(0) b(1) c(2) d(3) e(4) f(5) g(6) h(7) i(8) j(9)
|
|
||||||
Additional regs -> k(CmdLine) l(InstDir) m(OutDir) n(ExeDir) o(Lang)
|
|
||||||
Stack -> s (parameters are poped/pushed in default, right-to-left order)
|
|
||||||
None -> n (0 (null) for input / specifies no output is required)
|
|
||||||
|
|
||||||
VI. Functions.
|
|
||||||
--------------
|
|
||||||
|
|
||||||
Default return - on stack.
|
|
||||||
|
|
||||||
handle = Alloc(bytes)
|
|
||||||
ok? = Free(handle)
|
|
||||||
handle = AllocCopy(handle) -> creates a copy
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
addr = FullAddr(ProcID, ParamID) -> retrieve address for use with Call
|
|
||||||
Call = FullCall(ProcID, ParamID) -> Direct call
|
|
||||||
|
|
||||||
addr = PartAddr(ProcID)
|
|
||||||
Call = Call(addr)
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
Hint: These two change the passed proc, so if you want to preserve original
|
|
||||||
proc use AllocCopy...
|
|
||||||
|
|
||||||
addr = ShortAddr(addr, ParamID) -> For use if you half defined the proc
|
|
||||||
Call = ShortCall(addr, ParamID) -> by PartAddr
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
Comments (don't forget the * meaning :):
|
|
||||||
1. I'm using '?' as delimiter just because I need some character to use
|
|
||||||
as :). The other reason: '?' can't be spotted at dll paths and proc names.
|
|
||||||
2. Currently unsupported. Some features, like buffers/structures,
|
|
||||||
callbacks, different calling conventions, arg-lists, etc should become available
|
|
||||||
at future releases.
|
|
|
@ -64,8 +64,10 @@
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="1"
|
||||||
|
GlobalOptimizations="TRUE"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
|
FavorSizeOrSpeed="2"
|
||||||
OmitFramePointers="TRUE"
|
OmitFramePointers="TRUE"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSTEM_EXPORTS"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSTEM_EXPORTS"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
|
@ -81,11 +83,13 @@
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="kernel32.lib user32.lib"
|
AdditionalDependencies="kernel32.lib user32.lib vc7ldvrm.obj vc7lmul.obj vc7lshl.obj vc7lshr.obj "
|
||||||
OutputFile="$(OutDir)/System.dll"
|
OutputFile="$(OutDir)/System.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
IgnoreAllDefaultLibraries="TRUE"
|
IgnoreAllDefaultLibraries="TRUE"
|
||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
|
GenerateMapFile="TRUE"
|
||||||
|
MapExports="TRUE"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
OptimizeReferences="2"
|
OptimizeReferences="2"
|
||||||
EnableCOMDATFolding="2"
|
EnableCOMDATFolding="2"
|
||||||
|
@ -114,6 +118,14 @@
|
||||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
|
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
|
||||||
<File
|
<File
|
||||||
RelativePath="Buffers.c">
|
RelativePath="Buffers.c">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="1"
|
||||||
|
GlobalOptimizations="TRUE"
|
||||||
|
FavorSizeOrSpeed="2"/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="Plugin.c">
|
RelativePath="Plugin.c">
|
||||||
|
|
6
Contrib/System/WhatsNew.txt
Normal file
6
Contrib/System/WhatsNew.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
1. Syntax, with inline input
|
||||||
|
2. Int64 full support (conversion/operations/comparison)
|
||||||
|
3. Structures support
|
||||||
|
4. Callbacks support, including multilevel callbacks
|
||||||
|
5. Some useful rountines (Alloc, Free, Copy)
|
||||||
|
6. CDecl and StdCall calling conventions
|
BIN
Contrib/System/vc7ldvrm.obj
Normal file
BIN
Contrib/System/vc7ldvrm.obj
Normal file
Binary file not shown.
BIN
Contrib/System/vc7lmul.obj
Normal file
BIN
Contrib/System/vc7lmul.obj
Normal file
Binary file not shown.
BIN
Contrib/System/vc7lshl.obj
Normal file
BIN
Contrib/System/vc7lshl.obj
Normal file
Binary file not shown.
BIN
Contrib/System/vc7lshr.obj
Normal file
BIN
Contrib/System/vc7lshr.obj
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue