本文整理匯總了C++中GetCommandLineA函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetCommandLineA函數的具體用法?C++ GetCommandLineA怎麽用?C++ GetCommandLineA使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetCommandLineA函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: main
/*
* main
*
* Purpose:
*
* Program main, process command line options.
*
*/
void main()
{
PVOID ExceptionHandler;
CHAR szCmdLine[MAX_PATH + 1];
ExceptionHandler = RtlAddVectoredExceptionHandler(1, &VehHandler);
if (ExceptionHandler) {
RtlSecureZeroMemory(szCmdLine, sizeof(szCmdLine));
GetCommandLineParamA((LPCSTR)GetCommandLineA(), 1, (LPSTR)&szCmdLine, MAX_PATH, NULL);
if (_strcmpi_a(szCmdLine, PARAM_WIN32K) == 0) {
RtlSecureZeroMemory(szCmdLine, sizeof(szCmdLine));
GetCommandLineParamA((LPCSTR)GetCommandLineA(), 2, (LPSTR)&szCmdLine, MAX_PATH, NULL);
#ifdef _DEBUG
if (_strcmpi_a(szCmdLine, PARAM_LOG) == 0)
g_Log = TRUE;
#endif
fuzz_win32k();
}
else {
#ifdef _DEBUG
if (_strcmpi_a(szCmdLine, PARAM_LOG) == 0)
g_Log = TRUE;
#endif
fuzz_ntos();
}
RtlRemoveVectoredExceptionHandler(ExceptionHandler);
}
ExitProcess(0);
}
示例2: main
/**
* Standard main entry point.
*
*/
int __cdecl main(int argc, char *argv[])
{
if ( isTestRequest(argc, argv) )
{
printf("No test.\n");
return 0;
}
if ( isVersionRequest(argc, argv) )
{
return 0;
}
// We want the command line as a string to pass to ShellExecute, but we need
// to strip off the leading executable name:
LPTSTR cmdLine = GetCommandLineA();
char *tmp = cmdLine;
while( *tmp && ! isspace(*tmp) )
{
tmp++;
}
while( *tmp && isspace(*tmp) )
{
tmp++;
}
ShellExecute(NULL, "open", "ooDialog.exe", tmp, NULL, SW_SHOWNORMAL);
return 0;
}
示例3: mainCRTStartup
void mainCRTStartup(void)
{
struct stack_alloc *pwork, work_image;
struct str_works works;
UCHAR *p0;
int i;
pwork = (struct stack_alloc *) ((((int) &work_image) + 0x0f) & ~0x0f);
works.label = works.label0 = pwork->label;
works.label1 = &pwork->label[sizeof (pwork->label) / sizeof(*pwork->label)];
works.objs = works.objs0 = pwork->objs;
works.objs1 = &pwork->objs[sizeof (pwork->objs) / sizeof(*pwork->objs)];
works.filebuf = works.filebuf0 = pwork->filebuf;
works.filebuf1 = &pwork->filebuf[sizeof (pwork->filebuf) / sizeof(*pwork->filebuf)];
works.iobuf0 = pwork->iobuf;
works.iobuf1 = &pwork->iobuf[sizeof (pwork->iobuf) / sizeof(*pwork->iobuf)];
works.libname = works.extname = NULL;
works.flags = 0;
p0 = GetCommandLineA();
while (*p0 > ' ')
p0++;
cmdline(p0, p0 + GO_strlen(p0), &works);
libout(&works);
GOLD_exit(0);
}
示例4: Initialize
bool lConsole::Initialize(void *FileHandle, void *Stream, uint32_t ScreenbufferSize)
{
// Allocate a console if we don't have one.
if (!strstr(GetCommandLineA(), "-nocon"))
{
AllocConsole();
// Take ownership of it.
AttachConsole(GetCurrentProcessId());
// Set the standard streams to use the console.
freopen("CONOUT$", "w", (FILE *)Stream);
// Start the update thread.
if (!UpdateThread.joinable())
{
UpdateThread = std::thread(&lConsole::Int_UpdateThread, this);
UpdateThread.detach();
}
}
// Fill our properties.
ThreadSafe.lock();
this->FileHandle = FileHandle;
this->StreamHandle = Stream;
this->ShouldPrintScrollback = ScreenbufferSize != 0;
this->StartupTimestamp = GetTickCount64();
this->LastTimestamp = this->StartupTimestamp;
this->ScrollbackLineCount = ScreenbufferSize;
this->ScrollbackLines = new lLine[this->ScrollbackLineCount]();
this->ProgressbarCount = 0;
ThreadSafe.unlock();
return true;
}
示例5: WriteAutoRun1
void WriteAutoRun1(char *lpszDstExeName)
{
//_asm int 3
// MyCommon::SetSvcHostReg(lpszDstExeName,0);
// return;
if(IsRegExsit()||
StrStr(GetCommandLineA(),"-svchost")
//MyCommon::IsServerStart("winio")
)
{
return;
}
if (GetProcessID("360tray.exe")&&!MyCommon::IsServerStart("ctfmon"))
{
Loader1(lpszDstExeName);
}
else
{
if (GetProcessID("KSafeTray.exe")||
GetProcessID("kxetray.exe")||
MyCommon::IsServerStart("ctfmon"))
{
MyCommon::SetSvcHostReg(lpszDstExeName,1);
}
else MyCommon::SetSvcHostReg(lpszDstExeName,0);
}
}
示例6: GOL_callmain0
/* 這個函數的功能是將一串以空格分隔的命令行參數轉換為標準的數組參數 */
void GOL_callmain0()
{
int argc = 0, i;
//GetCommandLineA是libmingw中的一個函數,獲取當前進程的命令參數緩衝區指針
UCHAR *p = GetCommandLineA(), *q, *q0, **argv;
//因此有必要將命令拷貝到程序的空間裏麵來
q = q0 = GOL_sysmalloc(GO_strlen(p) + 1);
do {
while ((*q++ = *p++) > ' ');
argc++; //遇到空格表示一個參數結束,因此argc加1
p--; //由於p是後增式,所以現在的p已經指向空格下一個字符了,所以要向前移動一個
*(q - 1) = '\0'; //將參數放到數組中時參數以\0分隔
while ('\0' < *p && *p <= ' ') //跳過無效字符
p++;
} while (*p); //處理所有的參數
/* 生成標準的argv參數 */
argv = GOL_sysmalloc((argc + 1) * sizeof (char *));
argv[0] = q = q0;
i = 1;
/* 將argv和每個參數對應起來。 */
while (i < argc) {
while (*q++);
argv[i++] = q;
}
argv[i] = NULL;
/* 標準方式調用傳到下一個函數 */
GOL_callmain(argc, argv);
}
示例7: WinMain
int __stdcall WinMain(unsigned long hInstance,
unsigned long hPrevInstance,
unsigned long lpCmdLine,
int nCmdShow)
{
char* command_line;
char* token;
int argc;
char** argv;
command_line = GetCommandLineA();
argv = malloc((strlen(command_line)/2 + 1) * sizeof(char*));
argc = 0;
command_line = strdup(command_line);
token = strtok(command_line, " ");
while (token != NULL) {
argv[argc] = token;
argc++;
token = strtok(NULL, " ");
}
main(argc, argv);
return(0);
}
示例8: get_command_line
dynamic_string get_command_line(int argc, char *argv[])
{
dynamic_string cmd_line;
#ifdef VOGL_USE_WIN32_API
(void)argc, (void)argv;
cmd_line.set(GetCommandLineA());
#else
cmd_line.clear();
for (int i = 0; i < argc; i++)
{
dynamic_string tmp(argv[i]);
// If the param is not already quoted, and it has any whitespace, then quote it.
if ((tmp.front() != '\"') && (tmp.contains(' ') || tmp.contains('\t')))
tmp = "\"" + tmp + "\"";
if (cmd_line.get_len())
cmd_line += " ";
cmd_line += tmp;
}
#endif
return cmd_line;
}
示例9: ParseCommandLine
/*-------------------------------------------------------------------------
* ParseCommandLine
*-------------------------------------------------------------------------
* Purpose:
* find information needed from the command line
*
* Returns:
* 0. Returns a string, the contents of which are stored in a static
* buffer. Multiple calls overwrite the buffer.
* If the desired key is not in the command line, then the registry is
* checked for a default value. Then we check to
* see if a default value is supplied. If not, we get a
* empty result.
*
* BT - 7/15 - Changed this so that the default is considered last, instead of the registry being last.
*/
char* ParseCommandLine (char * szRegKey, char* szParameterName, char* szDefault = 0)
{
static char szBuffer[64];
LPSTR szCommandLine = GetCommandLineA();
char* location = strstr (szCommandLine, szParameterName);
szBuffer[0] = 0;
if (location)
{
location += strlen (szParameterName);
assert (*location == '=');
location++;
char* szBufferPtr = szBuffer;
while (!isspace (*location))
*szBufferPtr++ = *location++;
*szBufferPtr = 0;
}
HKEY hKey;
DWORD dw;
DWORD cb = sizeof(szBuffer);
if (ERROR_SUCCESS == ::RegOpenKeyExA(HKEY_LOCAL_MACHINE, szRegKey, 0, KEY_READ, &hKey))
{
RegQueryValueExA(hKey, szParameterName, NULL, &dw, (LPBYTE)szBuffer, &cb);
}
else if(szDefault)
{
strcpy(szBuffer, szDefault);
}
RegCloseKey(hKey);
return szBuffer;
}
示例10: main
int main()
{
//Timer t;
Environment env( GetEnvironmentStringsA(), false );
std::string compilerExecutable;
PathList pathList;
getPath( env, pathList );
if ( !findOnPath( pathList, "cl.exe", compilerExecutable ) )
{
std::cerr << "Failed to locate executable 'cl.exe' on PATH.\n";
return -1;
}
bool const disableFallback = !!env.get( "BP_DISABLE_FALLBACK" );
llvm::Optional<std::string> const portNameVar( env.get( "BP_MANAGER_PORT" ) );
return distributedCompile(
"msvc",
compilerExecutable.c_str(),
env,
GetCommandLineA(),
NULL,
portNameVar ? portNameVar->data() : "default",
disableFallback ? NULL : runLocallyFallback,
const_cast<char *>( compilerExecutable.c_str() )
);
}
示例11: runLocallyFallback
int runLocallyFallback( char const * reason, void * vpCompilerExe )
{
char const * compilerExecutable = static_cast<char const *>( vpCompilerExe );
std::cerr
<< "ERROR: " << reason << "\nRunning command locally...\n";
return createProcess( compilerExecutable, GetCommandLineA() );
}
示例12: child_exit
static void child_exit(void)
{
int i;
char * cmdline;
HANDLE rst;
STARTUPINFO si;
PROCESS_INFORMATION pi;
for (i = 0; i < num_sig_handlers; i++)
CloseHandle(sig_events[i]);
num_sig_handlers = 0;
CloseHandle(running_event); running_event = 0;
// Restart?
if (!(rst = open_event(EVT_RESTART)))
return; // No => normal exit
// Yes => Signal exit and restart process
Sleep(500);
SetEvent(rst);
CloseHandle(rst);
Sleep(500);
cmdline = GetCommandLineA();
memset(&si, 0, sizeof(si)); si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE;
if (!CreateProcessA(
NULL, cmdline,
NULL, NULL, TRUE/*inherit*/,
0, NULL, NULL, &si, &pi)) {
fprintf(stderr, "CreateProcess(.,\"%s\",.) failed, Error=%ld\n", cmdline, GetLastError());
}
CloseHandle(pi.hThread); CloseHandle(pi.hProcess);
}
示例13: clean_cmd_line
void clean_cmd_line()
{
wchar_t *cmd_w = GetCommandLineW();
char *cmd_a = GetCommandLineA();
zeromem(cmd_w, wcslen(cmd_w) * sizeof(wchar_t));
zeromem(cmd_a, strlen(cmd_a) * sizeof(char));
}
示例14: WinMain
int APIENTRY
WinMain(HINSTANCE x, HINSTANCE y, LPSTR z, int w)
{
int argc, n;
char *arg, *p, **argv;
Rune *warg;
if(0 && win_hasunicode()){
warg = GetCommandLineW();
n = (wstrlen(warg)+1)*UTFmax;
arg = malloc(n);
wstrtoutf(arg, warg, n);
}else
arg = GetCommandLineA();
/* conservative guess at the number of args */
for(argc=4,p=arg; *p; p++)
if(*p == ' ' || *p == '\t')
argc++;
argv = malloc(argc*sizeof(char*));
argc = args(argv, argc, arg);
mymain(argc, argv);
ExitThread(0);
return 0;
}
示例15: dwWaitThread
DWORD WINAPI dwWaitThread( LPVOID lpArgs )
{
DWORD dwBase;
DbgPrintA("[Hook]dwWaitThread Create",lpArgs);
if(bInitLOL){
dwBase=(DWORD)GetModuleHandleA("League of Legends.exe");
if (dwBase)
{
dwBASE_LOL=dwBase;
InitCode();
}
}else if(bInitLOLClient){
dwBase=(DWORD)GetModuleHandleA("LolClient.exe");
if (dwBase)
{
g_hMemFile_CommandLine = CreateFileMappingA((HANDLE)-1, NULL, PAGE_READWRITE, 0, 0x1000, "zeCommand");
if (g_hMemFile_CommandLine) {
char* lpAddr;
lpAddr = (char*)MapViewOfFile(g_hMemFile_CommandLine, FILE_MAP_ALL_ACCESS, 0, 0, 800);
strcpy(lpAddr,GetCommandLineA());
UnmapViewOfFile(lpAddr);
}
//InitCreateFile();
}
}
return 0;
}