Fixing a bug in CreateProcess whereby if the imagename was null, CreateProcessW was not called. Adding ShellExecute, ExpandEnvironmentStrings and ExpandEnvironmentStrings(A|W). WINCE only.

This commit is contained in:
dougt%meer.net 2005-09-02 18:05:04 +00:00
parent c9af0fc826
commit ef6cd24567
5 changed files with 79 additions and 21 deletions

Binary file not shown.

Binary file not shown.

View File

@ -441,7 +441,18 @@
#ifdef ExpandEnvironmentStrings
#undef ExpandEnvironmentStrings
#endif
#define ExpandEnvironmentStrings mozce_ExpandEnvironmentStrings
#ifdef ExpandEnvironmentStringsA
#undef ExpandEnvironmentStringsA
#endif
#ifdef ExpandEnvironmentStringsW
#undef ExpandEnvironmentStringsW
#endif
#define ExpandEnvironmentStrings mozce_ExpandEnvironmentStrings
#define ExpandEnvironmentStringsA mozce_ExpandEnvironmentStrings
#define ExpandEnvironmentStringsW mozce_ExpandEnvironmentStringsW
#ifdef FIXED
#undef FIXED
@ -676,6 +687,11 @@
#endif
#define SetWindowTextA mozce_SetWindowTextA
#ifdef ShellExecute
#undef ShellExecute
#endif
#define ShellExecute mozce_ShellExecute
#ifdef TlsAlloc
#undef TlsAlloc
#endif
@ -1344,6 +1360,7 @@ extern "C" {
MOZCE_SHUNT_API int mozce_SetStretchBltMode(HDC inDC, int inStretchMode);
MOZCE_SHUNT_API int mozce_ExtSelectClipRgn(HDC inDC, HRGN inRGN, int inMode);
MOZCE_SHUNT_API DWORD mozce_ExpandEnvironmentStrings(LPCTSTR lpSrc, LPTSTR lpDst, DWORD nSize);
MOZCE_SHUNT_API DWORD mozce_ExpandEnvironmentStringsW(const unsigned short * lpSrc, const unsigned short * lpDst, DWORD nSize);
MOZCE_SHUNT_API BOOL mozce_LineDDA(int inXStart, int inYStart, int inXEnd, int inYEnd, mozce_LINEDDAPROC inLineFunc, LPARAM inData);
MOZCE_SHUNT_API int mozce_FrameRect(HDC inDC, CONST RECT *inRect, HBRUSH inBrush);
@ -1367,6 +1384,7 @@ extern "C" {
MOZCE_SHUNT_API BOOL mozce_IsIconic(HWND inWnd);
MOZCE_SHUNT_API BOOL mozce_OpenIcon(HWND inWnd);
MOZCE_SHUNT_API HHOOK mozce_SetWindowsHookEx(int inType, void* inFunc, HINSTANCE inMod, DWORD inThreadId);
MOZCE_SHUNT_API HINSTANCE mozce_ShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd);
MOZCE_SHUNT_API BOOL mozce_UnhookWindowsHookEx(HHOOK inHook);
MOZCE_SHUNT_API LRESULT mozce_CallNextHookEx(HHOOK inHook, int inCode, WPARAM wParam, LPARAM lParam);
MOZCE_SHUNT_API BOOL mozce_GetWindowPlacement(HWND window, WINDOWPLACEMENT *lpwndpl);

View File

@ -1091,6 +1091,17 @@ MOZCE_SHUNT_API DWORD mozce_ExpandEnvironmentStrings(LPCTSTR lpSrc, LPTSTR lpDst
return 0;
}
MOZCE_SHUNT_API DWORD mozce_ExpandEnvironmentStringsW(LPCTSTR lpSrc, LPTSTR lpDst, DWORD nSize)
{
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_ExpandEnvironmentStrings called\n");
#endif
return 0;
}
MOZCE_SHUNT_API BOOL mozce_GdiFlush(void)
{
MOZCE_PRECHECK
@ -1115,6 +1126,43 @@ MOZCE_SHUNT_API BOOL mozce_GetWindowPlacement(HWND hWnd, WINDOWPLACEMENT *lpwndp
return TRUE;
}
MOZCE_SHUNT_API HINSTANCE mozce_ShellExecute(HWND hwnd,
LPCSTR lpOperation,
LPCSTR lpFile,
LPCSTR lpParameters,
LPCSTR lpDirectory,
INT nShowCmd)
{
LPTSTR op = a2w_malloc(lpOperation, -1, NULL);
LPTSTR file = a2w_malloc(lpFile, -1, NULL);
LPTSTR parm = a2w_malloc(lpParameters, -1, NULL);
LPTSTR dir = a2w_malloc(lpDirectory, -1, NULL);
SHELLEXECUTEINFO info;
info.cbSize = sizeof(SHELLEXECUTEINFO);
info.fMask = SEE_MASK_NOCLOSEPROCESS;
info.hwnd = hwnd;
info.lpVerb = op;
info.lpFile = file;
info.lpParameters = parm;
info.lpDirectory = dir;
info.nShow = nShowCmd;
BOOL b = ShellExecuteEx(&info);
if (op)
free(op);
if (file)
free(file);
if (parm)
free(parm);
if (dir)
free(dir);
return (HINSTANCE) info.hProcess;
}
#if 0
{
#endif
@ -1124,7 +1172,7 @@ void dumpMemoryInfo()
{
MEMORYSTATUS ms;
ms.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&ms);

View File

@ -236,25 +236,17 @@ MOZCE_SHUNT_API BOOL mozce_CreateProcessA(LPCSTR pszImageName, LPCSTR pszCmdLine
#ifdef DEBUG
mozce_printf("mozce_CreateProcessA called\n");
#endif
BOOL retval = FALSE;
TCHAR pszImageNameW[MAX_PATH];
if(a2w_buffer(pszImageName, -1, pszImageNameW, MAX_PATH))
{
LPTSTR pszCmdLineW = NULL;
pszCmdLineW = a2w_malloc(pszCmdLine, -1, NULL);
if(NULL != pszCmdLineW || NULL == pszCmdLine)
{
retval = CreateProcessW(pszImageNameW, pszCmdLineW, NULL, NULL, FALSE, fdwCreate, NULL, NULL, NULL, pProcInfo);
if(NULL != pszCmdLineW)
{
free(pszCmdLineW);
}
}
}
LPTSTR image = a2w_malloc(pszImageName, -1, NULL);
LPTSTR cmdline = a2w_malloc(pszCmdLine, -1, NULL);
BOOL retval = CreateProcessW(image, cmdline, NULL, NULL, FALSE, fdwCreate, NULL, NULL, NULL, pProcInfo);
if (image)
free(image);
if (cmdline)
free(cmdline);
return retval;
}