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
Родитель 918dd9e8bd
Коммит 05d1e61030
5 изменённых файлов: 79 добавлений и 21 удалений

Двоичные данные
build/wince/shunt/build/shunt.vcb

Двоичный файл не отображается.

Двоичные данные
build/wince/shunt/build/shunt.vco

Двоичный файл не отображается.

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

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