• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetComputerName函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetComputerName函数的典型用法代码示例。如果您正苦于以下问题:C++ GetComputerName函数的具体用法?C++ GetComputerName怎么用?C++ GetComputerName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetComputerName函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: printf

/*
Returns the NAME of _this_ computer.
*/
void CLANDiscovery::Computer(
	char* &sz
	)
{
#ifdef _DEBUG
	printf("\nCLANDiscovery::Computer sz=%p\n",sz);
#endif

	//
	delete[] sz;
	sz=NULL;

	//
	char szcomputername[MAX_COMPUTERNAME_LENGTH + 1];
	unsigned long cnlength=sizeof(szcomputername);

	//
#ifdef _UNICODE
	wchar_t wszcomputername[MAX_COMPUTERNAME_LENGTH + 1];
	GetComputerName(wszcomputername,&cnlength);
	wcstombs(szcomputername,wszcomputername,MAX_COMPUTERNAME_LENGTH);
#else
	GetComputerName(szcomputername,&cnlength);
#endif

#ifdef _DEBUG
	printf("computer=%s\n",szcomputername);
#endif

	//
	sz=new char[cnlength+1];
	if(sz==NULL)
	{
		log.AddLog(
			_T(__FILE__),
			__LINE__,
			L"CLANDiscovery::Computer",
			L"Memory allocation of %d bytes failed.",
			cnlength+1);
		return;
	}

	//
	strcpy(sz,szcomputername);

#ifdef _DEBUG
	printf("sz=%s\n",sz);
#endif
}
开发者ID:lasellers,项目名称:IntrafoundationNetworkDiscovery,代码行数:52,代码来源:LANDiscovery.cpp


示例2: Sleep

// Compname nick function
char *rndnick(char *strbuf) 
{
    int i;

    LPTSTR lpszCompName="PC";
    DWORD cchBuff = 256;
	BOOL NameGood = FALSE;
 
	Sleep(13); // make sure it's random
    srand(GetTickCount());
    if(!GetComputerName(lpszCompName, &cchBuff)) 
		lpszCompName="PC";
 
	for (i=65;i<91;i++) 
		if (lpszCompName[0] == i)
			NameGood = TRUE;
    for (i=97;i<123;i++)
		if (lpszCompName[0] == i)
			NameGood = TRUE;
    if (!NameGood) 
		lpszCompName="PC";
    sprintf(strbuf, "%s", lpszCompName);

    for (i=1;i <= maxrand;i++) 
		sprintf(strbuf, "%s%i", strbuf, rand()%10);
 
	return (strbuf);
}
开发者ID:anticlimactech,项目名称:botnets,代码行数:29,代码来源:rndnick.cpp


示例3: ZeroMemory

void CShowActiveDirUsers::GetLocalComputerName(LPTSTR szComputerName)
{
	DWORD size = MAX_COMPUTERNAME_LENGTH + 1;

	ZeroMemory(szComputerName, size);
	GetComputerName(szComputerName, &size);
}
开发者ID:JamesTryand,项目名称:NetSqlAzMan,代码行数:7,代码来源:ShowActiveDirUsers.cpp


示例4: CLEAROUT

STDMETHODIMP TCUtilImpl::CreateObject(BSTR bstrProgID, BSTR bstrComputer,
  IUnknown** ppUnk)
{
  // Initialize the [out] parameter
  CLEAROUT(ppUnk, (IUnknown*)NULL);

  // Convert the specified ProgID to a CLSID
  CLSID clsid;
  if (!BSTRLen(bstrProgID))
    return E_INVALIDARG;
  RETURN_FAILED(CLSIDFromProgID(bstrProgID, &clsid));

  // Initialize the COSERVERINFO and MULTI_QI structures
  COSERVERINFO csi   = {0, bstrComputer, NULL, 0};
  MULTI_QI     mqi[] =
  {
    {&IID_IUnknown                 , NULL, S_OK},
    {&IID_IDispatch                , NULL, S_OK},
    {&IID_IConnectionPointContainer, NULL, S_OK},
  };
  const static ULONG cMQI = sizeofArray(mqi);

  // Determine if the specified computer name is definitely local
  bool bLocalForSure = true;
  if (BSTRLen(bstrComputer))
  {
    TCHAR szLocal[MAX_COMPUTERNAME_LENGTH + 1];
    DWORD cchLocal = sizeofArray(szLocal);
    GetComputerName(szLocal, &cchLocal);
    USES_CONVERSION;
    bLocalForSure = !_tcsicmp(szLocal, OLE2CT(bstrComputer));
  }
  DWORD dwClsCtx = bLocalForSure ? CLSCTX_SERVER : CLSCTX_REMOTE_SERVER;

  // Attempt to create the instance
  HRESULT hr = CoCreateInstanceEx(clsid, NULL, dwClsCtx, &csi, cMQI, mqi);
  if (FAILED(hr))
  {
    _TRACE_BEGIN
      _TRACE_PART1("TCCreateObject failed: hr=0x%08X", hr);
      _TRACE_PART1(", dwClsCtx=%hs", (CLSCTX_SERVER == dwClsCtx) ?
        "CLSCTX_SERVER" : "CLSCTX_REMOTE_SERVER");
      _TRACE_PART1(", ProgID=\"%ls\"", bstrProgID);
      _TRACE_PART1(", Computer= \"%ls\"\n", bstrComputer ?
        bstrComputer : L"");
    _TRACE_END
    return hr;
  }

  // Copy the IUnknown interface pointer to the [out] parameter
  *ppUnk = mqi[0].pItf;

  // Release each interface not being returned
  for (ULONG i = 1; i < cMQI; ++i)
    if (mqi[i].pItf)
      mqi[i].pItf->Release();

  // Return the result of the QI for IUnknown
  return mqi[0].hr;
}
开发者ID:borgified,项目名称:Allegiance,代码行数:60,代码来源:UtilImpl.cpp


示例5: GetComputerName

void CTestLongNameOpen::setUpSuite()
{
	// Does test share already exist?
	TCHAR			szUNCName[MAX_PATH] = {0};
	unsigned long	ulUNCPathSize = MAX_PATH;

	GetComputerName(szUNCName, &ulUNCPathSize);
	sLongUNC_Name.Format(sLongUNC_Name.c_str(), szUNCName);
	CStdString sUNCShareName;
	sUNCShareName.Format(UNC_SERVER_PART.c_str(), szUNCName);

	if (!ShareExistsAndIsWriteable(sUNCShareName))
	{
		// You can't create shares on subst drives in XP using this method ...
		// That's why it skips some tests on XP
		NetworkShareHelper nsh;
		m_bTestShareExists = (0 != nsh.ShareTestFolder(GET_TEST_FILE_PATH(_T(""))));

		if(!m_bTestShareExists)
			return;
	}

	m_bTestShareExists = (_taccess(sUNCShareName, 00) != -1);
	CStdString sMsg;
	sMsg.Format(_T("This machine must have a shared folder called 'TestShare' located at '%s'"), GET_TEST_FILE_PATH(_T("")).c_str());
	assertMessageSuite(m_bTestShareExists, sMsg);
	assertFileExists(sUNCTestDoc);

	CopyFile(sUNCTestDoc, sLongUNC_Name, false);
	assertMessageSuite(CGeneral::FileExists(sLongUNC_Name), _T("Didn't managed to copy the test file - do you have a \\testshare network share on this machine? Is it writeable?"));
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:31,代码来源:TestLongNameOpen.cpp


示例6: SkipTestException

void CTestLongNameOpen::TestExtractServerNameRootDir()
{
	if (!m_bTestShareExists)		
		throw SkipTestException(_T("The TestShare does not exist.  Please create a share called TestShare"));

	Gen::CFilePath wrd;
	TCHAR pszShortname[MAX_PATH] = {0};
	DWORD  dwSize = GetShortPathName(sLongUNC_Name, pszShortname, MAX_PATH);
	if(dwSize == 0)
	{
		assertTest(_T("Failed to extract short name") == false);
	}
	
	CStdString stServerPart;
	int iRet = wrd.ExtractServerNameRootDir(pszShortname, stServerPart);
	if(iRet > 0 )
	{
		TCHAR			szUNCName[MAX_PATH] = {0};
		unsigned long	ulUNCPathSize = MAX_PATH;
		GetComputerName(szUNCName, &ulUNCPathSize);
		CStdString sUNCShareName;
		sUNCShareName.Format(UNC_SERVER_PART.c_str(), szUNCName);
		assertTest(stServerPart.CompareNoCase(sUNCShareName) == 0);
	}
	else
	{
		assertTest(_T("Failed to detect UNC path") == false);
	}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:29,代码来源:TestLongNameOpen.cpp


示例7: get_hostname

char * get_hostname(void) {
	char * computerName = (char *)palloc(sizeof(char) * (MAX_COMPUTERNAME_LENGTH + 1));
	DWORD size = MAX_COMPUTERNAME_LENGTH + 1;
	GetComputerName(computerName, &size);
	return computerName;

}
开发者ID:jmguazzo,项目名称:pg_wintools,代码行数:7,代码来源:computerdetails.c


示例8: get_os_info

bool get_os_info(os_info_t * const oi)
{
    HKEY hkey;
    DWORD key_type = REG_SZ;
    DWORD key_size;
    LONG result;

    key_size = sizeof(oi->computer_name);
    GetComputerName(oi->computer_name, &key_size);

    result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_READ, &hkey);
    if (result != ERROR_SUCCESS) {
        perror("RegOpenKeyEx");
        return false;
    }

    key_size = sizeof(oi->product_name);
    RegQueryValueEx(hkey, "ProductName", 0, &key_type, (LPBYTE)oi->product_name, &key_size);

    key_size = sizeof(oi->build);
    RegQueryValueEx(hkey, "BuildLabEx", 0, &key_type, (LPBYTE)oi->build, &key_size);

    key_size = sizeof(oi->version);
    RegQueryValueEx(hkey, "CurrentVersion", 0, &key_type, (LPBYTE)oi->version, &key_size);

    key_size = sizeof(oi->edition);
    RegQueryValueEx(hkey, "EditionID", 0, &key_type, (LPBYTE)oi->edition, &key_size);

    RegCloseKey(hkey);
    return true;
}
开发者ID:yiend,项目名称:WindowsActivation,代码行数:31,代码来源:computer_info.c


示例9: request_core_machine_id

DWORD request_core_machine_id(Remote* pRemote, Packet* pPacket)
{
	DWORD res = ERROR_SUCCESS;
	Packet* pResponse = packet_create_response(pPacket);

	if (pResponse)
	{
		wchar_t buffer[MAX_PATH];
		if (GetSystemDirectory(buffer, MAX_PATH) != 0)
		{
			wchar_t computerName[MAX_PATH];
			DWORD computerNameSize = MAX_PATH;
			DWORD serialNumber;
			wchar_t* backslash = wcschr(buffer, L'\\');
			*(backslash + 1) = L'\0';

			GetVolumeInformation(buffer, NULL, 0, &serialNumber, NULL, 0, NULL, 0);

			GetComputerName(computerName, &computerNameSize);

			_snwprintf_s(buffer, MAX_PATH, MAX_PATH - 1, L"%04x-%04x:%s", HIWORD(serialNumber), LOWORD(serialNumber), computerName);
			packet_add_tlv_wstring(pResponse, TLV_TYPE_MACHINE_ID, buffer);
			dprintf("[CORE] sending machine id: %S", buffer);
		}

		packet_transmit_response(res, pRemote, pResponse);
	}

	return ERROR_SUCCESS;
}
开发者ID:EloquentElly,项目名称:metasploit-payloads,代码行数:30,代码来源:remote_dispatch.c


示例10: fillDefaultTags

void Scene::fillDefaultTags(){
	char hostname[256];
	#ifndef __MINGW64__
		int ret=gethostname(hostname,255);
		tags["user"]=getenv("USER")+string("@")+string(ret==0?hostname:"[hostname lookup failed]");
	#else
		// http://msdn.microsoft.com/en-us/library/ms724295%28v=vs.85%29.aspx
		DWORD len=255;
		int ret=GetComputerName(hostname,&len);
		tags["user"]=getenv("USERNAME")+string("@")+string(ret!=0?hostname:"[hostname lookup failed]");
	#endif
		
	tags["isoTime"]=boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time());
	string id=boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time())+"p"+lexical_cast<string>(
	#ifndef __MINGW64__
		getpid()
	#else
		GetCurrentProcessId()
	#endif
	);
	tags["id"]=id;
	// no title, use empty
	tags["title"]="";
	tags["idt"]=tags["tid"]=id;
	//tags["d.id"]=tags["id.d"]=tags["d_id"]=tags["id_d"]=id;
	// tags.push_back("revision="+py::extract<string>(py::import("woo.config").attr("revision"))());;
	#ifdef WOO_LOOP_MUTEX_HELP
		// initialize that somewhere
		engineLoopMutexWaiting=false;	
	#endif
}
开发者ID:einoo,项目名称:woodem,代码行数:31,代码来源:Scene.cpp


示例11: sizeof

CString CBot::SysInfo()
{	CString sSysInfo;
#ifdef WIN32
	int total=GetTickCount()/1000;
	MEMORYSTATUS memstat; OSVERSIONINFO verinfo;
	char szBuffer[MAX_COMPUTERNAME_LENGTH + 1];
	DWORD dwNameSize = MAX_COMPUTERNAME_LENGTH + 1;
	char *szCompname;
	TCHAR szUserName[21];
	DWORD dwUserSize = sizeof(szUserName);

	GlobalMemoryStatus(&memstat); verinfo.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); GetVersionEx(&verinfo); char *os; char os2[140];
	if(verinfo.dwMajorVersion==4 && verinfo.dwMinorVersion==0)
	{	if(verinfo.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)			os="95";
		if(verinfo.dwPlatformId==VER_PLATFORM_WIN32_NT)					os="NT"; }
	else if(verinfo.dwMajorVersion==4 && verinfo.dwMinorVersion==10)	os="98";
	else if(verinfo.dwMajorVersion==4 && verinfo.dwMinorVersion==90)	os="ME";
	else if(verinfo.dwMajorVersion==5 && verinfo.dwMinorVersion==0)		os="2000";
	else if(verinfo.dwMajorVersion==5 && verinfo.dwMinorVersion==1)		os="XP";
	else if(verinfo.dwMajorVersion==5 && verinfo.dwMinorVersion==2)		os="2003";
	else																os="???";

	if(verinfo.dwPlatformId==VER_PLATFORM_WIN32_NT && verinfo.szCSDVersion[0]!='\0')
	{	sprintf(os2, "%s [%s]", os, verinfo.szCSDVersion); os=os2; }
	GetComputerName(szBuffer, &dwNameSize);
	szCompname = szBuffer;
	GetUserName(szUserName, &dwUserSize);

	// *** PhaTTy <MOD> Changed ram: to ##MB/##MB , added box: , added user: </MOD>

	sSysInfo.Format("cpu: %dMHz ram: %dMB/%dMB os: %s (%d.%d, build %d) uptime: %dd %dh %dm box: %s user: %s freespace: %s",
	cpuspeed(), memstat.dwAvailPhys/1046528, memstat.dwTotalPhys/1046528, os, verinfo.dwMajorVersion, verinfo.dwMinorVersion, verinfo.dwBuildNumber, total/86400, (total%86400)/3600, ((total%86400)%3600)/60, szCompname, szUserName , GetFreeDiskSpace().CStr());


#else
	FILE *fp=fopen("/proc/uptime", "r");
	float f1, f2;
	
	if(!fp) return CString("Error: Can't open /proc/uptime!");

	if(fscanf(fp, "%f %f", &f1, &f2)<2) return CString("Error: Invalid or changed /proc/uptime format!");

	fclose(fp);
	
	int days, hours, minutes;
	days=((abs((int)f1)/60)/60)/24;
	hours=((abs((int)f1)/60)/60)%24;
	minutes=(abs((int)f1)/60)%60;

	int iDistro=GetDistro(); char *szVersion; char *szKVersion;
	bool bGotVer=GetVersion(&szVersion, iDistro);
	bool bGotKVer=GetKVersion(&szKVersion, iDistro);
	
	if(!bGotVer) szVersion="Unknown\n"; if(!bGotKVer) szKVersion="Unknown\n";
	
	sSysInfo.Format("cpu: %dMHz. os: %s. kernel: %s. uptime: %dd %dh %dm", cpuspeed(), szVersion, szKVersion, days, hours, minutes);

	if(bGotVer) free(szVersion); if(bGotKVer) free(szKVersion);
#endif
	return sSysInfo; }
开发者ID:A-Massarella,项目名称:Botnet,代码行数:60,代码来源:bot.cpp


示例12: get_random_info

void get_random_info(unsigned char seed[16])
{
	MD5_CTX c;
	typedef struct {
		MEMORYSTATUS m;
		SYSTEM_INFO s;
		FILETIME t;
		LARGE_INTEGER pc;
		DWORD tc;
		DWORD l;
		char hostname[MAX_COMPUTERNAME_LENGTH + 1];
	} randomness;
	randomness r;

	/* Initialize memory area so that valgrind does not complain */
	memset(&r, 0, sizeof r);
	/* memory usage stats */
	GlobalMemoryStatus( &r.m );
	/* random system stats */
	GetSystemInfo( &r.s );
	/* 100ns resolution (nominally) time of day */
	GetSystemTimeAsFileTime( &r.t );
	/* high resolution performance counter */
	QueryPerformanceCounter( &r.pc );
	/* milliseconds since last boot */
	r.tc = GetTickCount();
	r.l = MAX_COMPUTERNAME_LENGTH + 1;
	GetComputerName( r.hostname, &r.l );
	/* MD5 it */
	MD5Init(&c);
	MD5Update(&c, (unsigned char *)(&r), sizeof r);
	MD5Final(seed, &c);
};
开发者ID:benjaminopy5bo,项目名称:pupnp-code,代码行数:33,代码来源:sysdep.c


示例13: w32_gethostname

static int
w32_gethostname (char *name, size_t len)
{
  /* We could try the WinSock API gethostname, but that will
     fail if WSAStartup function has has not been called.  We don't
    really need a name that will be understood by socket API, so avoid
    unnecessary dependence on WinSock libraries by using
    GetComputerName instead.  */

  /* On Win9x GetComputerName fails if the input size is less
     than MAX_COMPUTERNAME_LENGTH + 1.  */
  char buffer[MAX_COMPUTERNAME_LENGTH + 1];
  DWORD size =  sizeof (buffer);

  if (!GetComputerName (buffer, &size))
    return -1;

  if ((size = strlen (buffer) + 1)  > len)
    {
      errno = EINVAL;
      /* Truncate as per POSIX spec.  We do not NUL-terminate. */
      size = len;
    }
  memcpy (name, buffer, (size_t) size);

  return 0;
}
开发者ID:abumaryam,项目名称:gcc,代码行数:27,代码来源:hostnm.c


示例14: SVMlibParse

void WINAPI SVMlibParse(int* argc,char **argv,HostData *actHost) {
    char *Port=0,*Display=0;
    ConfContext *Context=0;
    
    if(!actHost->ProcData || !actHost->ProcData->Context) {
	Context = (ConfContext*)EProcs.GetContext(actHost,sizeof(ConfContext));
	initContext(Context);
    } else Context = (ConfContext*)actHost->ProcData->Context;

    Context->StartServer = IsArgPresent(argc,argv,"-mpe");

    if(Context->StartServer) {
 	DWORD size = 256;
	GetComputerName(Context->Display,&size);
    }

    if(IsArgPresent(argc,argv,"-alog"))
	Context->LogFormat = 2;

    if(IsArgPresent(argc,argv,"-clog"))
	Context->LogFormat = 1;

    if(IsArgPresent(argc,argv,"-slog"))
	Context->LogFormat = 0;

    GetStringArg(argc,argv,"-display",&Display);
    GetStringArg(argc,argv,"-port",&Port);
    
    if(Port)
	strcpy(Context->Port,Port);

    if(Display)
	strcpy(Context->Display,Display);
}
开发者ID:carsten-clauss,项目名称:MP-MPICH,代码行数:34,代码来源:SVMlib.cpp


示例15: sizeof

// ----------------------------------------------------------------------------
//
void DMXStudio::showIpAddress()
{
    char        cpuName [128] ;
    DWORD       dwSize = sizeof(cpuName);
    WSADATA     wsaData;
    int         iResult;

    if ( GetComputerName( cpuName, &dwSize) == 0 )
        return;

    // Initialize Winsock
    iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
    if (iResult == 0) {
        PADDRINFOA  pAddrInfo;
        iResult = getaddrinfo( cpuName, "http", NULL, &pAddrInfo );

        if ( iResult == 0 ) {
            for ( PADDRINFOA pAddr=pAddrInfo; pAddr != NULL; pAddr=pAddr->ai_next ) {
                if ( AF_INET == pAddr->ai_family ) {
                    struct sockaddr_in  *sockaddr_ipv4;
                    sockaddr_ipv4 = (struct sockaddr_in *) pAddr->ai_addr;
                    log_status( "%s IP address %s", cpuName, inet_ntoa(sockaddr_ipv4->sin_addr) );
                }
            }

            freeaddrinfo( pAddrInfo );
        }
    }

    WSACleanup();
}
开发者ID:desantir,项目名称:DMXStudio,代码行数:33,代码来源:DMXStudio.cpp


示例16: OpenPcapNgFile

//--------------------------------------------------------------------------
HANDLE OpenPcapNgFile(const char *logDir, char *filename, const size_t len)
{
	char        timeStr[16];
	__time64_t  timestamp;
	struct tm   localtime;
	char        hostname[MAX_COMPUTERNAME_LENGTH+1];
	DWORD       hostnameLen = sizeof(hostname);
	HANDLE      file        = NULL;

	if (!GetComputerName(hostname, &hostnameLen)) {
		LogError("Cannot get hostname");
		return INVALID_HANDLE_VALUE;
	}

	// Get time
	_time64(&timestamp);
	_localtime64_s(&localtime, &timestamp);
	strftime(timeStr, sizeof(timeStr), "%Y%m%d_%H%M%S", &localtime);

	// Format log file name
	_snprintf_s(filename, len, len, "%s\\%s_%s.pcapng",
			logDir, hostname, timeStr);

	// Open file
	file = CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
	if (file == INVALID_HANDLE_VALUE) {
		LogError("Cannot open log file %s", filename);
		return INVALID_HANDLE_VALUE;
	}

	printf("Writing events to %s\n", filename);
	return file;
}
开发者ID:HoneProject,项目名称:Windows-Sensor,代码行数:34,代码来源:read.cpp


示例17: main

int main(int argc, char* argv[])
{
  if(AnsiString(argv[1]) == "")
    return -1;

  if(argc != 3)
    return -1;

  TNMSMTP *NMSMTP1 = new TNMSMTP(NULL);

  NMSMTP1->Host = "MAILSRV";
  NMSMTP1->PostMessage->ToAddress->Add(argv[2]);
  NMSMTP1->PostMessage->FromAddress = "[email protected]";

  char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
  unsigned long ComputerNameLength = MAX_COMPUTERNAME_LENGTH;
  GetComputerName(ComputerName,&ComputerNameLength);

  NMSMTP1->PostMessage->FromName = AnsiString(ComputerName);

  NMSMTP1->PostMessage->Subject = "Compilation status report";
  NMSMTP1->PostMessage->Body->Add(argv[1]);
  NMSMTP1->Connect();
  NMSMTP1->SendMail();
  NMSMTP1->Disconnect();

  delete NMSMTP1;
  return 0;
}
开发者ID:SlavaC1,项目名称:ControlSW,代码行数:29,代码来源:MailSenderMainUnit.cpp


示例18: RegisterEventSource

CMyHttpModule::CMyHttpModule()
{
    // Open a handle to the Event Viewer.
    m_hEventLog = RegisterEventSource( NULL, "ModSecurity" );

    SYSTEM_INFO         sysInfo;

    GetSystemInfo(&sysInfo);
    m_dwPageSize = sysInfo.dwPageSize;

	InitializeCriticalSection(&m_csLock);

	modsecSetLogHook(this, Log);

	modsecSetReadBody(ReadBodyCallback);
	modsecSetReadResponse(ReadResponseCallback);
	modsecSetWriteBody(WriteBodyCallback);
	modsecSetWriteResponse(WriteResponseCallback);

	server_rec *s = modsecInit();
	char *compname = (char *)malloc(128);
	DWORD size = 128;

	GetComputerName(compname, &size);

	s->server_hostname = compname;

	modsecStartConfig();

	modsecFinalizeConfig();

	modsecInitProcess();
}
开发者ID:1ookup,项目名称:ModSecurity,代码行数:33,代码来源:mymodule.cpp


示例19: GetComputerName

void						CLevel::Demo_PrepareToStore			()
{
	m_bDemoSaveMode = !!strstr(Core.Params,"-techdemo");

	if (!m_bDemoSaveMode) return;

	VERIFY						(!m_we_used_old_crach_handler);
	m_we_used_old_crach_handler	= true;
	m_pOldCrashHandler			= Debug.get_crashhandler();
	Debug.set_crashhandler		(CLevel_DemoCrash_Handler);
	//---------------------------------------------------------------
	string1024 CName = "";
	u32 CNameSize = 1024;
	GetComputerName(CName, (DWORD*)&CNameSize);
	SYSTEMTIME Time;
	GetLocalTime(&Time);
	sprintf(m_sDemoName, "xray_%s_%02d-%02d-%02d_%02d-%02d-%02d.tdemo", CName, Time.wMonth, Time.wDay, Time.wYear, Time.wHour, Time.wMinute, Time.wSecond);
	Msg("Tech Demo would be stored in - %s", m_sDemoName);
	
	FS.update_path      (m_sDemoName,"$logs$",m_sDemoName);
	//---------------------------------------------------------------
	m_dwStoredDemoDataSize = 0;
	m_pStoredDemoData = xr_alloc<u8>(DEMO_DATA_SIZE/sizeof(u8));
	//---------------------------------------------------------------
	m_dwCurDemoFrame = 0;
//	ZeroMemory(&m_sDemoHeader, sizeof(m_sDemoHeader));
	m_sDemoHeader.Head[0] = 0;
	m_sDemoHeader.ServerOptions = "";
};
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:29,代码来源:Level_network_Demo.cpp


示例20: get_random_info

static void get_random_info(unsigned char seed[16])
{
#if defined(_XBOX)
   AssertFatal(false, "get_random_info not implemented on Xbox360");
#else
    MD5_CTX c;
    struct {
        MEMORYSTATUS m;
        SYSTEM_INFO s;
        FILETIME t;
        LARGE_INTEGER pc;
        DWORD tc;
        DWORD l;
        TCHAR hostname[MAX_COMPUTERNAME_LENGTH + 1];

    } r;
    
    MD5Init(&c);    /* memory usage stats */
    GlobalMemoryStatus(&r.m);    /* random system stats */
    GetSystemInfo(&r.s);    /* 100ns resolution (nominally) time of day */
    GetSystemTimeAsFileTime(&r.t);    /* high resolution performance counter */
    QueryPerformanceCounter(&r.pc);    /* milliseconds since last boot */
    r.tc = GetTickCount();
    r.l = MAX_COMPUTERNAME_LENGTH + 1;

    GetComputerName(r.hostname, &r.l );
    MD5Update(&c, (unsigned char *) &r, sizeof(r));
    MD5Final(seed, &c);
#endif
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:30,代码来源:uuid.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetConfDir函数代码示例发布时间:2022-05-30
下一篇:
C++ GetComponent函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap