* Basic System::Call support when compiling with 64-bit MinGW/GCC toolchain

* Win64 fixes


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6607 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2015-09-17 14:30:07 +00:00
parent 757d16f937
commit 286edd20c4
41 changed files with 335 additions and 232 deletions

View file

@ -131,7 +131,7 @@ NSISFunc(SetBg) {
hWndImage = CreateWindowEx(
WS_EX_TOOLWINDOW,
(LPTSTR)(DWORD)atomClass,
(LPTSTR)(UINT_PTR)atomClass,
0,
WS_CLIPSIBLINGS|WS_POPUP,
0,
@ -293,7 +293,7 @@ NSISFunc(AddText) {
lstrcpy(newImg->szText, szTemp);
popstring(szTemp);
newImg->hFont = (HFONT)myatoi(szTemp);
newImg->hFont = (HFONT) nsishelper_str_to_ptr(szTemp);
newImg->cTextColor = GetColor();
GetXY(LPPOINT(&newImg->rPos));

View file

@ -564,7 +564,7 @@ int WINAPI ReadSettings(void) {
pField->nMaxLength = myGetProfileInt(_T("MaxLen"), 0);
// Text color for LINK control, default is the system default link color
pField->hImage = (HANDLE)myGetProfileInt(_T("TxtColor"), GetLinkColor());
pField->hImage = (HANDLE)(UINT_PTR) myGetProfileInt(_T("TxtColor"), GetLinkColor());
pField->nControlID = 1200 + nIdx;
if (pField->nType == FIELD_FILEREQUEST || pField->nType == FIELD_DIRREQUEST)
@ -788,7 +788,7 @@ INT_PTR CALLBACK cfgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
{
// Get TxtColor unless the user has set another using SetCtlColors
if (!GetWindowLongPtr(lpdis->hwndItem, GWLP_USERDATA))
SetTextColor(lpdis->hDC, (COLORREF) pField->hImage);
SetTextColor(lpdis->hDC, (COLORREF)(INT_PTR) pField->hImage);
// Draw the text
DrawText(lpdis->hDC, pField->pszText, -1, &rc, DT_CENTER | DT_VCENTER | DT_WORDBREAK | (bRTL ? DT_RTLREADING : 0));
@ -1212,7 +1212,7 @@ int WINAPI createCfgDlg()
rect.right - rect.left,
rect.bottom - rect.top,
hConfigWindow,
(HMENU)pField->nControlID,
(HMENU)(UINT_PTR) pField->nControlID,
m_hInstance,
NULL
);

View file

@ -13,7 +13,7 @@
void RegFile(TCHAR cmd, TCHAR *file, int x64);
void RegDll(TCHAR *file);
void RegTypeLib(TCHAR *file);
void DeleteFileOnReboot(TCHAR *pszFile);
BOOL DeleteFileOnReboot(TCHAR *pszFile);
NSIS_ENTRYPOINT_GUINOCRT
EXTERN_C void NSISWinMainNOCRT()
@ -367,9 +367,9 @@ void RenameViaWininit(const TCHAR* prevName, const TCHAR* newName)
}
#endif
void DeleteFileOnReboot(TCHAR *pszFile)
BOOL DeleteFileOnReboot(TCHAR *pszFile)
{
BOOL fOk = 0;
BOOL fOk = FALSE;
HMODULE hLib=GetModuleHandle(_T("KERNEL32.dll"));
if (hLib)
{
@ -385,6 +385,8 @@ void DeleteFileOnReboot(TCHAR *pszFile)
if (!fOk)
{
RenameViaWininit(pszFile, NULL);
fOk = TRUE; // BUGBUG: We just pretend everything is OK, nobody checks our return value anyway
}
#endif
return fOk;
}

View file

@ -683,8 +683,8 @@ void ShowDocs() {
path=_tcsrchr(pathf,_T('\\'));
if(path!=NULL) *path=0;
lstrcat(pathf,LOCALDOCS);
if ((int)ShellExecute(g_sdata.hwnd,_T("open"),pathf,NULL,NULL,SW_SHOWNORMAL)<=32)
ShellExecuteA(g_sdata.hwnd,"open",DOCPATH,NULL,NULL,SW_SHOWNORMAL);
if ((int)(INT_PTR) ShellExecute(g_sdata.hwnd,_T("open"),pathf,NULL,NULL,SW_SHOWNORMAL) <= 32)
ShellExecuteA(g_sdata.hwnd,"open",DOCPATH,NULL,NULL,SW_SHOWNORMAL);
}
TCHAR* BuildSymbols()

View file

@ -11,6 +11,8 @@ extern "C" int _fltused;
int _fltused = 1;
#endif
#define EIPtrToInt(pEI) ( (int) (INT_PTR) (pEI) ) // Make GCC (64-bit) happy. BUGBUG64: Somebody should verify that this truncation is OK
ExpressionItem *stack;
int UserVarsCount, UserFuncsCount;
@ -28,8 +30,8 @@ void PlaceNewItem(TCHAR *&vb, ParseInfo *pi, int precedence)
PlaceVariable(vb, pi);
if (pi->item == NULL) return;
while ((pi->OpsStack) && ((((int) pi->OpsStack->param2) < precedence)
|| ((((int)pi->OpsStack->param2) == precedence)
while ((pi->OpsStack) && (((EIPtrToInt(pi->OpsStack->param2)) < precedence)
|| (((EIPtrToInt(pi->OpsStack->param2)) == precedence)
&& (precedence != OPERATOR_SET_PRECEDENCE))))
{
// second operand for our operator
@ -300,7 +302,7 @@ void PlaceOp(TCHAR *&vb, int type, int precedence, ParseInfo *pi)
// uniary pre op
ExpressionItem *item = AllocItem();
item->type = type;
item->param2 = (EIPARAM) precedence;
item->param2 = (EIPARAM) (INT_PTR) precedence;
item->next = pi->OpsStack;
pi->OpsStack = item;
}
@ -323,7 +325,7 @@ void PlaceOp(TCHAR *&vb, int type, int precedence, ParseInfo *pi)
} else
{
// binary operator
item->param2 = (EIPARAM) precedence;
item->param2 = (EIPARAM) (INT_PTR) precedence;
item->next = pi->OpsStack;
pi->OpsStack = item;
}
@ -857,7 +859,7 @@ void SaveResult(ExpressionItem *var, ExpressionItem *result)
break;
case ITV_ARRITEM:
{
ExpressionItem *&ei = ((ArrayDesc*)(var->param1))->array[(int)var->param2];
ExpressionItem *&ei = ((ArrayDesc*)(var->param1))->array[(UINT_PTR)(var->param2)];
CleanupItems(ei);
ei = CopyItem(result);
}
@ -880,9 +882,9 @@ void SaveResult(ExpressionItem *var, ExpressionItem *result)
}
}
void RunAndGetConst(int from, ExpressionItem* &result, int type)
void RunAndGetConst(ExpressionItem* from, ExpressionItem* &result, int type)
{
RunTree(*((ExpressionItem**)&(from)), result, type | RTO_NEEDCONST);
RunTree(from, result, type | RTO_NEEDCONST);
ItemToType(result, type);
}
@ -930,7 +932,7 @@ void RunTree(ExpressionItem *from, ExpressionItem* &result, int options)
case ITV_ARRITEM:
{
// array item
ExpressionItem *ei = ((ArrayDesc*)(item->param1))->array[(int)item->param2];
ExpressionItem *ei = ((ArrayDesc*)(item->param1))->array[(UINT_PTR)(item->param2)];
if (ei)
result = CopyItem(ei);
else
@ -1115,7 +1117,7 @@ void RunTree(ExpressionItem *from, ExpressionItem* &result, int options)
int ir = -666;
TCHAR *i1 = (item1)?((TCHAR*)item1->param1):(NULL);
TCHAR *i2 = (item2)?((TCHAR*)item2->param1):(NULL);
int sc = (i1 && i2)?(lstrcmp(i1, i2)):((i1)?(1):((i2)?(-1):(0)));
int sc = (i1 && i2)?(lstrcmp(i1, i2)):((i1)?(1):((i2)?(-1):(0)));
switch (subtype)
{
@ -1176,7 +1178,7 @@ void RunTree(ExpressionItem *from, ExpressionItem* &result, int options)
}
while (true)
{
RunAndGetConst((int) ifbr, result, ITC_INT);
RunAndGetConst((ifbr), result, ITC_INT);
if (ifmode)
{
// we need then or else branch?
@ -1260,20 +1262,21 @@ void RunTree(ExpressionItem *from, ExpressionItem* &result, int options)
CleanupItems(si); CleanupItems(var);
} else if (subtype == ITF_TYPE)
{
int newtype = (int) MathFunctions[ioptions].fptr;
INT_PTR newtype = (INT_PTR) MathFunctions[ioptions].fptr;
if (newtype < ITC_UNKNOWN)
{
// get as possibly close to ready expression
RunAndGetConst((int)item->param1, result, newtype);
int truncatednewtype = (int) newtype; // BUGBUG64: Make sure this is safe for 64-bit, meaning, can newtype be < INT_MIN?
RunAndGetConst((item->param1), result, truncatednewtype);
if (ioptions == ITFT_CARRAY_ID)
CopyArray(result);
} else if (newtype == FTT_FLOATF)
{
// float format function
ExpressionItem *arg1, *arg2;
RunAndGetConst((int)item->param1, arg1, ITC_FLOAT);
RunAndGetConst((item->param1), arg1, ITC_FLOAT);
double value = *((double*)&(arg1->param1));
RunAndGetConst((int)item->param2, arg2, ITC_INT);
RunAndGetConst((item->param2), arg2, ITC_INT);
int format = (int) *((__int64*)&(arg2->param1));
result = AllocItem();
@ -1331,7 +1334,7 @@ void RunTree(ExpressionItem *from, ExpressionItem* &result, int options)
} else
{
// oops :-o function call :)
RunAndGetConst((int)item->param1, result, ITC_FLOAT);
RunAndGetConst((item->param1), result, ITC_FLOAT);
double &value = *((double*)&(result->param1));
if (subtype == ITF_MATH1)
{
@ -1365,7 +1368,7 @@ void RunTree(ExpressionItem *from, ExpressionItem* &result, int options)
{
// normal 2-arg math function
ExpressionItem *arg2;
RunAndGetConst((int)item->param2, arg2, ITC_FLOAT);
RunAndGetConst((item->param2), arg2, ITC_FLOAT);
double value2 = *((double*)&(arg2->param1));
value = ((Math2FuncPtr)(MathFunctions[ioptions].fptr))(value, value2);
CleanupItems(arg2);
@ -1388,7 +1391,7 @@ void RunTree(ExpressionItem *from, ExpressionItem* &result, int options)
if ((*((ExpressionItem **) &(item->param2)))->type != IT_EXPRESSION)
{
// one index - user need a char
RunAndGetConst((int)item->param2, index, ITC_INT);
RunAndGetConst((item->param2), index, ITC_INT);
int pos = (int) *((__int64*)&(index->param1));
if (pos < 0) pos += len; // -index - means from end
@ -1408,7 +1411,7 @@ void RunTree(ExpressionItem *from, ExpressionItem* &result, int options)
if ((*((ExpressionItem **) &(item->param2)))->param1 == 0)
index = AllocItem();
else
RunAndGetConst((int)(*((ExpressionItem **) &(item->param2)))->param1, index, ITC_INT);
RunAndGetConst(((*((ExpressionItem **) &(item->param2)))->param1), index, ITC_INT);
if ((*((ExpressionItem **) &(item->param2)))->next->param1 == 0)
{
// if second index is skipped -> -1 (till last char)
@ -1416,7 +1419,7 @@ void RunTree(ExpressionItem *from, ExpressionItem* &result, int options)
*((__int64*)&(index2->param1)) = -1;
}
else
RunAndGetConst((int)(*((ExpressionItem **) &(item->param2)))->next->param1, index2, ITC_INT);
RunAndGetConst(((*((ExpressionItem **) &(item->param2)))->next->param1), index2, ITC_INT);
// ok, we've got two indexes
int pos1 = (int) *((__int64*)&(index->param1));
@ -1445,16 +1448,16 @@ void RunTree(ExpressionItem *from, ExpressionItem* &result, int options)
} else
{
// argument is array
RunAndGetConst((int)item->param2, index, ITC_INT);
RunAndGetConst((item->param2), index, ITC_INT);
// convert array pointer to array item pointer
aritem->type = IT_VARIABLE | ITV_ARRITEM;
aritem->param2 = (EIPARAM) *((__int64*)&(index->param1));
ArrayDesc *ad = (ArrayDesc*)aritem->param1;
if (((int)aritem->param2) >= ad->count)
if ((EIPtrToInt(aritem->param2)) >= ad->count)
{
ad->count = ((int)aritem->param2)+1;
ad->count = (EIPtrToInt(aritem->param2))+1;
while (ad->count > ad->size)
{
// resize array

View file

@ -17,8 +17,12 @@
#define strcasecmp(x,y) stricmp(x,y)
#define ERRNO (WSAGetLastError())
#define SET_SOCK_BLOCK(s,block) { unsigned long __i=block?0:1; ioctlsocket(s,FIONBIO,&__i); }
#ifndef EWOULDBLOCK
#define EWOULDBLOCK WSAEWOULDBLOCK
#endif
#ifndef EINPROGRESS
#define EINPROGRESS WSAEWOULDBLOCK
#endif
#define memset mini_memset
#define memcpy mini_memcpy
// Jim Park: For Unicode support, we need to distinguish whether we are working on

View file

@ -29,34 +29,30 @@ Import('BuildPlugin env')
defs = ['SYSTEM_EXPORTS']
msvc = 'msvc' in env['TOOLS'] or 'mstoolkit' in env['TOOLS']
if env['TARGET_ARCH'] != 'amd64' or msvc: # BUGBUG: Call-amd64.S is missing GAS macros
srcsuff = ''
if env['TARGET_ARCH'] != 'x86':
srcsuff = '-' + env['TARGET_ARCH']
defs += ['SYSTEM_NOCALLBACKS'] # BUGBUG: Remove this when CallBack() is implemented
if msvc: # BUGBUG: Remove this when GAS is fixed
defs += ['SYSTEM_PARTIALCALLSUPPORT']
filename = 'Call' + srcsuff
srcsuff = ''
if env['TARGET_ARCH'] != 'x86':
srcsuff = '-' + env['TARGET_ARCH']
defs += ['SYSTEM_NOCALLBACKS'] # BUGBUG: Remove this when CallBack() is implemented
defs += ['SYSTEM_PARTIALCALLSUPPORT']
filename = 'Call' + srcsuff
src_ascpp = """
#if 0 /* a C style comment */
ERROR: assembler-with-cpp required!
#else
.end
#endif
"""
conf = env.Configure()
if conf.TryCompile('END', '.S'):
files += ['Source/'+filename+'.S']
elif (not msvc) and conf.TryCompile(src_ascpp, '.S'):
files += ['Source/'+filename+'CPP.S']
elif (not msvc) and conf.TryCompile(src_ascpp, '.sx'):
files += ['Source/'+filename+'CPP.sx']
else:
print 'WARNING: System.dll: unable to find assembler for '+filename+'.S'
conf.Finish()
src_ascpp = """
#if 0 /* a C style comment */
ERROR: assembler-with-cpp required!
#else
.end
#endif
"""
conf = env.Configure()
if conf.TryCompile('END', '.S'):
files += ['Source/'+filename+'.S']
elif (not msvc) and conf.TryCompile(src_ascpp, '.S'):
files += ['Source/'+filename+'CPP.S']
elif (not msvc) and conf.TryCompile(src_ascpp, '.sx'):
files += ['Source/'+filename+'CPP.sx']
else:
print 'WARNING: System.dll: missing Win64 code, dynamic function calls not supported'
print 'WARNING: System.dll: unable to find assembler for '+filename+'.S'
conf.Finish()
BuildPlugin(
target,

View file

@ -15,6 +15,9 @@
;# MASM:
;# ml64.exe /c Call-amd64.S
;#
;# Notes:
;# * MASM does not accept 0x* constants and GAS does not accept *h constants in Intel mode, must use decimal!
;#
; .if 0
;# MASM
@ -34,6 +37,7 @@ IF 0
; .else
;# GNU
.intel_syntax noprefix
.set __GNU__,1
#define IFDEF .ifdef
#define ELSE .else
@ -45,6 +49,15 @@ IF 0
#define END .end
#define EXTERN .extern
.macro FUNC_DECL name
.global \name
.func \name
\name:
.endm
.macro FUNC_END name
.endfunc
.endm
;# ~GNU
ENDIF
@ -68,14 +81,18 @@ SECTION_CODE
FUNC_DECL CallProc2 ;# rcx=SystemProc* edx=ParamCount
mov [rsp+8h], r12
mov [rsp+10h], r13
mov [rsp+18h], r14
;#mov [rsp+20h], r15
mov [rsp+8], r12
mov [rsp+16], r13
mov [rsp+24], r14
;#mov [rsp+32], r15
;# The stack is unaligned on function entry. We have to calculate the required
;# stack size for our parameters + maybe 8 padding bytes to end up 16 byte aligned.
IFDEF __GNU__
#define pSystemProc r14
ELSE
pSystemProc equ r14
ENDIF
mov pSystemProc, rcx ;# Save SystemProc*
;# Not required since we zero-extend eax: xor rax, rax
mov r13d, edx ;# Save ParamCount
@ -84,9 +101,9 @@ FUNC_DECL CallProc2 ;# rcx=SystemProc* edx=ParamCount
jnz noparamalignpadding
lea eax, [eax+8] ;# sizeof(params) + 8 will make us 16 byte aligned
noparamalignpadding:
cmp eax, 28h ;# The ABI guarantees shadow space for the 4 register parameters
cmp eax, 40 ;# The ABI guarantees shadow space for the 4 register parameters
ja computedstacksize
mov eax, 28h ;# Minimum (4*8) + 8 to align
mov eax, 40 ;# Minimum (4*8) + 8 to align
computedstacksize:
mov r12d, eax ;# Save stack size (Zero-extended mov)
sub rsp, r12
@ -170,10 +187,10 @@ capturegle_done:
;# add/lea rsp and pop is valid in the epilog. Unwind might fail on our version?
add rsp, r12 ;# Restore stack
;# Restore nonvolatile registers:
mov r12, [rsp+8h]
mov r13, [rsp+10h]
mov r14, [rsp+18h]
;#mov r15, [rsp+20h]
mov r12, [rsp+8]
mov r13, [rsp+16]
mov r14, [rsp+24]
;#mov r15, [rsp+32]
ret
FUNC_END CallProc2

View file

@ -0,0 +1,8 @@
#ifdef _MSC_VER
#error "MSVC is supposed to use the plain .S file!"
#endif
#if 0
ERROR: assembler-with-cpp required!
#else
#include "Call-amd64.S"
#endif

View file

@ -0,0 +1,8 @@
#ifdef _MSC_VER
#error "MSVC is supposed to use the plain .S file!"
#endif
#if 0
ERROR: assembler-with-cpp required!
#else
#include "Call-amd64CPP.S"
#endif

View file

@ -276,31 +276,8 @@ PLUGINFUNCTION(Get)
#ifdef _WIN64
/*
TODO: CallProc/Back not implemeted.
Fake the behavior of the System plugin for the LoadImage API function so MUI works.
BUGBUG: MUI is leaking DeleteObject and failing GetClientRect
BUGBUG: TODO: CallBack support not implemeted!
*/
#ifndef SYSTEM_PARTIALCALLSUPPORT
SystemProc* CallProc(SystemProc *proc)
{
INT_PTR ret, *place;
LastError = lstrcmp(proc->ProcName, sizeof(TCHAR) > 1 ? _T("LoadImageW") : _T("LoadImageA"));
if (!LastError)
{
ret = (INT_PTR) LoadImage((HINSTANCE)proc->Params[1].Value,
(LPCTSTR)proc->Params[2].Value, (UINT)proc->Params[3].Value,
(int)proc->Params[4].Value, (int)proc->Params[5].Value,
(UINT)proc->Params[6].Value);
LastError = GetLastError();
}
else
proc->ProcResult = PR_ERROR, ret = 0;
place = (INT_PTR*) proc->Params[0].Value;
if (proc->Params[0].Option != -1) place = (INT_PTR*) &(proc->Params[0].Value);
if (place) *place = ret;
return proc;
}
#endif // ~SYSTEM_PARTIALCALLSUPPORT
SystemProc* CallBack(SystemProc *proc)
{
proc->ProcResult = PR_ERROR;
@ -461,7 +438,7 @@ SystemProc *PrepareProc(BOOL NeedForCall)
TCHAR *ibuf, *ib, *sbuf, *cbuf, *cb;
unsigned int UsedTString = 0;
#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) < 4006
#ifdef __GNUC__
temp3 = 0; // "warning: 'temp3' may be used uninitialized in this function": temp3 is set to 0 when we start parsing a new parameter
#endif
@ -692,14 +669,7 @@ SystemProc *PrepareProc(BOOL NeedForCall)
case _T('0'): case _T('1'): case _T('2'): case _T('3'): case _T('4'):
case _T('5'): case _T('6'): case _T('7'): case _T('8'): case _T('9'):
// Numeric inline
#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) >= 4006
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized" // temp3 is set to 0 when we start parsing a new parameter
#endif
if (temp3 == 0)
#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) >= 4006
#pragma GCC diagnostic pop
#endif
{
ib--;
// It's stupid, I know, but I'm too lazy to do another thing
@ -768,14 +738,7 @@ SystemProc *PrepareProc(BOOL NeedForCall)
if (temp3 == 1)
proc->Params[ParamIndex].Output = (int) temp4; // Note: As long as we never assign a pointer to temp4 when parsing a destination the cast to int is OK.
// Next parameter is output or something else
#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) >= 4006
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif
temp3++;
#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) >= 4006
#pragma GCC diagnostic pop
#endif
}
ChangesDone = PCD_DONE;
@ -1384,7 +1347,7 @@ Returns offset for element Clone of SystemProc structure
*/
unsigned int GetCloneOffset(void)
{
return (unsigned int)(&(((SystemProc *)0)->Clone));
return (unsigned int)(UINT_PTR) (&(((SystemProc *)0)->Clone));
}
/*
@ -1392,7 +1355,7 @@ Returns offset for element ProcName of SystemProc structure
*/
unsigned int GetProcNameOffset(void)
{
return (unsigned int)(&(((SystemProc *)0)->ProcName));
return (unsigned int)(UINT_PTR) (&(((SystemProc *)0)->ProcName));
}
/*
@ -1400,7 +1363,7 @@ Returns offset for element ArgsSize of SystemProc structure
*/
unsigned int GetArgsSizeOffset(void)
{
return (unsigned int)(&(((SystemProc *)0)->ArgsSize));
return (unsigned int)(UINT_PTR) (&(((SystemProc *)0)->ArgsSize));
}
/*
@ -1432,7 +1395,7 @@ Returns offset for element Size of ProcParameter structure
*/
unsigned int GetSizeOffsetParam(void)
{
return (unsigned int)(&(((ProcParameter *)0)->Size));
return (unsigned int)(UINT_PTR) (&(((ProcParameter *)0)->Size));
}
/*

View file

@ -155,10 +155,8 @@ extern void ParamsDeAllocate(SystemProc *proc);
extern void ParamsIn(SystemProc *proc);
extern void ParamsOut(SystemProc *proc);
#ifdef SYSTEM_AMD64
#ifdef SYSTEM_PARTIALCALLSUPPORT
extern SystemProc* CallProc2(SystemProc *proc, UINT_PTR ParamCount);
#define CallProc(p) CallProc2((p), (p)->ParamCount) // ParamCount is passed as a parameter so CallProc2 can determine the required stack size without a function call
#endif
#else // !SYSTEM_AMD64
extern SystemProc* CallProc(SystemProc *proc);
#endif // ~SYSTEM_AMD64

View file

@ -71,7 +71,7 @@ TCHAR* GetAccountTypeHelper(BOOL CheckTokenForGroupDeny)
(CHECKTOKENMEMBERSHIP) GetProcAddress(
GetModuleHandle(_T("ADVAPI32")), "CheckTokenMembership");
#else
_CheckTokenMembership = CheckTokenMembership;
CheckTokenMembership;
#endif
// Use "old school" membership check?

View file

@ -8,9 +8,7 @@
#include "defs.h"
#ifdef _countof
#define COUNTOF _countof
#else
#ifndef COUNTOF
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#endif

View file

@ -33,7 +33,7 @@ static COLORREF GetLinkColor()
struct nsControl* NSDFUNC GetControl(HWND hwCtl)
{
unsigned id = (unsigned) GetProp(hwCtl, NSCONTROL_ID_PROP);
unsigned id = (unsigned)(UINT_PTR) GetProp(hwCtl, NSCONTROL_ID_PROP);
if (id == 0 || id > g_dialog.controlCount)
{

View file

@ -7,9 +7,7 @@
#include <ctype.h>
#include <commctrl.h>
#ifdef _countof
#define COUNTOF _countof
#else
#ifndef COUNTOF
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#endif