📄 prun.c
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*****************************************************************************
PROGRAM: pRun.c
******************************************************************************/
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <string.h>
#include <rapi.h>
#include <strsafe.h>
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
WCHAR wszProgram[MAX_PATH];
int main( int argc, char *argv[])
{
HRESULT hRapiResult;
HRESULT hr;
PROCESS_INFORMATION pi;
if (2 != argc)
{
_tprintf( TEXT("Syntax: PRUN <WinCE EXE>"));
return 1;
}
else
{
#ifdef UNICODE
int nResult = MultiByteToWideChar(
CP_ACP,
MB_PRECOMPOSED,
argv[1],
strlen(argv[1])+1,
wszProgram,
ARRAYSIZE(wszProgram));
if(0 == nResult)
{
return 1;
}
#else
hr = StringCchCopy(wszProgram, ARRAYSIZE(wszProgram), argv[1]);
if(FAILED(hr))
{
return 1;
}
#endif
}
_tprintf( TEXT("Connecting to Windows CE..."));
hRapiResult = CeRapiInit();
if (FAILED(hRapiResult))
{
_tprintf( TEXT("Failed\n"));
return 1;
}
_tprintf( TEXT("Success\n"));
if (!CeCreateProcess(
wszProgram,
NULL,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
NULL,
&pi))
{
_tprintf( TEXT("CreateProcess failed with Errorcode = %ld\n"), CeGetLastError());
}
else
{
CeCloseHandle( pi.hProcess);
CeCloseHandle( pi.hThread);
}
_tprintf( TEXT("Closing connection ..."));
CeRapiUninit();
_tprintf( TEXT("Done\n"));
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -