diff --git a/Source/Platform.h b/Source/Platform.h index f9c45d10..699d4d30 100644 --- a/Source/Platform.h +++ b/Source/Platform.h @@ -492,6 +492,12 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG; # define SHACF_FILESYSTEM 1 #endif +#ifndef SEE_MASK_NOCLOSEPROCESS +#define SEE_MASK_NOCLOSEPROCESS 0x00000040 +#define SEE_MASK_FLAG_NO_UI 0x00000400 +#define SEE_MASK_FLAG_DDEWAIT 0x00000100 +#endif + // other stuff #ifndef CP_ACP diff --git a/Source/script.cpp b/Source/script.cpp index 27d65047..8e58530e 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -3257,7 +3257,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) ret=RunChildProcessRedirected(exec, forceutf8 ? true : false); else #endif //~ _WIN32 - ret=sane_system(exec); + ret=sane_system(exec), (void)forceutf8; // forceutf8 is not used on POSIX if (comp == 5) { _stprintf(buf,_T("%d"),ret); @@ -5425,7 +5425,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) ERROR_MSG(_T("%") NPRIs _T(": %d bytes of data exceeded\n"),cmdname,sizeof(data)); return PS_ERROR; } - if (multisz && (data_len < 4 || *(UINT32*)(&data[data_len-4]))) PRINTHELPEX(cmdname); + if (multisz && (data_len < 4 || 0 != read_ptr_as(&data[data_len-4]))) PRINTHELPEX(cmdname); // Must end with 4 zero bytes SCRIPT_MSG(_T("%") NPRIs _T(": %") NPRIs _T("\\%") NPRIs _T("\\%") NPRIs _T("=%") NPRIs _T("\n"), cmdname,line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4)); if (multisz && !build_unicode) for (int p1=0, p2=p1; p1 < data_len; data_len--) data[p1++]=data[p2], p2+=2; // BUGBUG: Should convert each string from UTF-16 to DBCS but only exehead knows the codepage, limited to ASCII for now. diff --git a/Source/util.h b/Source/util.h index 30337d94..7abc34b4 100644 --- a/Source/util.h +++ b/Source/util.h @@ -276,6 +276,15 @@ FILE* my_fopen(const TCHAR *path, const char *mode); // assumption: T is an int type template inline T align_to_512(const T x) { return (x+511) & ~511; } +template inline T read_ptr_as(const void*p) +{ +#if defined(_MSC_VER) && (_MSC_VER-0 < 1400) // TODO: Figure out which versions are able to optimize the memcpy + return *(T*)(p); +#else + T t; memcpy(&t, p, sizeof(T)); return t; +#endif +} + // some values need to be truncated from size_t to [unsigned] int, using this function is better than a plain cast template inline R internaltruncate_cast(T t) { assert((~((T)0)) > T(0)); // Only unsigned types supported right now