当前位置: 首页>>代码示例>>C++>>正文


C++ GetCommandLineA函数代码示例

本文整理汇总了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);
}
开发者ID:samghub,项目名称:NtCall64,代码行数:40,代码来源:main.c

示例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;
}
开发者ID:KlemensEngel,项目名称:oorexxforandroid,代码行数:35,代码来源:oodMain.cpp

示例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);
}
开发者ID:bigpussy,项目名称:harib_os_src,代码行数:27,代码来源:golib00.c

示例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;
}
开发者ID:KerriganEN,项目名称:OpenNetPlugin,代码行数:35,代码来源:lConsole.cpp

示例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);

	}
}
开发者ID:cugxiangzhenwei,项目名称:TSP_Zhenwei,代码行数:31,代码来源:TSPLoader1.cpp

示例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);
}
开发者ID:hanjianqiao,项目名称:cpp0_annotation_in_chinese,代码行数:31,代码来源:drv_w32.c

示例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);
}
开发者ID:AndrewGlynn,项目名称:opendylan,代码行数:25,代码来源:main.c

示例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;
    }
开发者ID:IanAtLunarG,项目名称:vogl,代码行数:25,代码来源:vogl_command_line_params.cpp

示例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;
 }
开发者ID:BackTrak,项目名称:Allegiance-R4-Engine,代码行数:49,代码来源:sqlhelp.cpp

示例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() )
    );
}
开发者ID:pkesist,项目名称:buildpal,代码行数:28,代码来源:bp_cl.cpp

示例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() );
}
开发者ID:pkesist,项目名称:buildpal,代码行数:7,代码来源:bp_cl.cpp

示例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);
}
开发者ID:ADVANTECH-Corp,项目名称:WISEAgent,代码行数:35,代码来源:daemon_win32.cpp

示例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));	
}
开发者ID:dwalkes,项目名称:RDXEncryption,代码行数:7,代码来源:console.c

示例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;
}
开发者ID:99years,项目名称:plan9,代码行数:26,代码来源:win32.c

示例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;
}
开发者ID:BlazingForests,项目名称:LOLDetour_ch,代码行数:28,代码来源:LOLDetour.cpp


注:本文中的GetCommandLineA函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。