Example #1
0
static BOOL Main_ShowMountTab(void)
{
    HKEY hk;
    BOOL bShow = FALSE;
    BOOL bSuccess = FALSE;

    if (RegOpenKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, 0,
                       (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
    {
        DWORD dwSize = sizeof(bShow);
        DWORD dwType = REG_DWORD;
        bSuccess = (RegQueryValueEx (hk, TEXT("ShowMountTab"), NULL, &dwType, (PBYTE)&bShow, &dwSize) == 0);
        RegCloseKey (hk);
    }

    if (!bSuccess &&
        RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY, 0,
                      (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
    {
        DWORD dwSize = sizeof(bShow);
        DWORD dwType = REG_DWORD;
        bSuccess = (RegQueryValueEx (hk, TEXT("ShowMountTab"), NULL, &dwType, (PBYTE)&bShow, &dwSize) == 0);
        RegCloseKey (hk);
    }

    return bShow;
}
Example #2
0
void Main_OnCheckTerminate (void)
{
    HKEY hk;
    BOOL bSuccess = FALSE;

    if (RegOpenKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, 0,
                      (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
    {
        DWORD dwSize = sizeof(g.fStartup);
        DWORD dwType = REG_DWORD;
        bSuccess = (RegQueryValueEx (hk, TEXT("ShowTrayIcon"), NULL, &dwType, (PBYTE)&g.fStartup, &dwSize) == 0);
        RegCloseKey (hk);
    }

    if (bSuccess &&
        RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY, 0,
                      (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
    {
        DWORD dwSize = sizeof(g.fStartup);
        DWORD dwType = REG_DWORD;
        RegQueryValueEx (hk, TEXT("ShowTrayIcon"), NULL, &dwType, (PBYTE)&g.fStartup, &dwSize);
        RegCloseKey (hk);
    }

    Shortcut_FixStartup (cszSHORTCUT_NAME, g.fStartup);

    if (!g.fStartup)
        Quit();
}
Example #3
0
long
RegOpenKeyAlt(HKEY key,               /* [in] open key from which to start */
	      const char *subKeyName, /* [in] sub key path */
	      DWORD mode,             /* [in] desired access */
	      int create,             /* [in] if set, creates key(s) on path */
	      HKEY *resultKeyP,       /* [out] open key handle */
	      DWORD *resultKeyDispP)  /* [out] open key disposition */
{
    long status;
    DWORD keyDisp = REG_OPENED_EXISTING_KEY;

    if (key == AFSREG_NULL_KEY) {
	/* No starting key; first path component must be predefined key.
	 * NOTE: predefined keys are always open (i.e., don't need opening).
	 */
	const char *tokenP = subKeyName + strspn(subKeyName, "\\");
	size_t tokenSz = strcspn(tokenP, "\\");

	if (!strncmp(tokenP, "HKEY_LOCAL_MACHINE", tokenSz))
	    key = HKEY_LOCAL_MACHINE;
	else if (!strncmp(tokenP, "HKEY_CURRENT_USER", tokenSz))
	    key = HKEY_CURRENT_USER;
	else if (!strncmp(tokenP, "HKEY_CURRENT_CONFIG", tokenSz))
	    key = HKEY_CURRENT_CONFIG;
	else if (!strncmp(tokenP, "HKEY_USERS", tokenSz))
	    key = HKEY_USERS;
	else if (!strncmp(tokenP, "HKEY_CLASSES_ROOT", tokenSz))
	    key = HKEY_CLASSES_ROOT;
	else if (!strncmp(tokenP, "HKEY_PERFORMANCE_DATA", tokenSz))
	    key = HKEY_PERFORMANCE_DATA;
	else if (!strncmp(tokenP, "HKEY_DYN_DATA", tokenSz))
	    key = HKEY_DYN_DATA;
	else {
	    return ERROR_INVALID_PARAMETER;
	}

	subKeyName = tokenP + tokenSz + 1;
    }

    /* open (and possibly create) sub key */
    if (create) {
	status = RegCreateKeyEx(key, subKeyName,
				(DWORD)0, "AFS", REG_OPTION_NON_VOLATILE,
				(IsWow64()?KEY_WOW64_64KEY:0)|mode, NULL, resultKeyP, &keyDisp);
    } else {
	status = RegOpenKeyEx(key, subKeyName, (DWORD)0, (IsWow64()?KEY_WOW64_64KEY:0)|mode, resultKeyP);
    }

    if (resultKeyDispP) {
	*resultKeyDispP = keyDisp;
    }

    return status;
}
CString ConnectionLimit::WriteConnections(DWORD conns)
{
	PVOID oldValue = NULL;
	TCHAR windir[MAX_PATH];
	GetWindowsDirectory(windir, MAX_PATH);
		
	CString patchedFiles;
	for(int i=0; i<3; ++i)
	{
		CString path(windir);
		switch(i)
		{
			case 0:
				path+=DIR_LOC;
			break;
			case 1:
				path+=DIR_LOC_1;
			break;
			case 2:
				path+=DIR_LOC_2;
			break;
		}
		int id = GetBuildID(path);
		CFile file;
		DWORD dwOffset = 0;
		dwOffset = GetOffset(path);
		bool wasPatched = true;
		if(IsWow64())
		{
			MyWow64DisableWow64FsRedirection(&oldValue);
		}
		if(file.Open(path,CFile::modeReadWrite))
		{
			if(IsWow64())
			{
				MyWow64RevertWow64FsRedirection(oldValue);
			}
			if(dwOffset)
			{
				file.Seek(dwOffset,CFile::begin);
				file.Write(&conns, sizeof(conns));
				file.Close();
				DWORD checkSum = ComputeCheckSum(path);
				patchedFiles+=path;
				patchedFiles+="\n";
			}
		}
		int err = GetLastError();
	}
	
	return patchedFiles;
}
bool ConnectionLimit::PatchVista()
{

	PVOID oldValue = NULL;
	TCHAR windir[MAX_PATH];
	GetWindowsDirectory(windir, MAX_PATH);
	CString path(windir);
	path+=DIR_LOC;
	int id = GetBuildID(path);
	if(id != 16384)
		return false;
	
	CFile file;
	DWORD dwOffset = 0;
	dwOffset = GetOffset(path);
	if(IsWow64())
	{
		MyWow64DisableWow64FsRedirection(&oldValue);
	}
	if(!file.Open(path,CFile::modeReadWrite))
	{
		//unlock file if not alredy unlocked
		UnlockFile(path);
	}
	else
	{
		file.Close();
	}
	if(file.Open(path,CFile::modeReadWrite))
	{
		if(IsWow64())
		{
			MyWow64RevertWow64FsRedirection(oldValue);
		}
		if(dwOffset)
		{
			file.Seek(dwOffset,CFile::begin);
			TCHAR num = 0x90;
			for(int i = 0; i<6; ++i)
			{
				file.Write(&num,sizeof(num));
			}
			file.Close();
			DWORD checkSum = ComputeCheckSum(path);
			return true;
		}
	}
	return false;
}
Example #6
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     pCmdLine,
                     int       nCmdShow)
{
	INT_PTR CALLBACK DialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

	g_instance_handle = hInstance;
	g_unicode_system = ::GetVersion() < DWORD(0x80000000);

	if (!g_unicode_system)
	{
		::MessageBox(0, _T("Windows 9x/Me is not supported by this version of ExifPro. Please use ExifPro version 1.0."), g_INSTALLER, MB_ICONERROR | MB_OK);
		return 0;
	}

	g_IsWindows64 = IsWow64();

	::CoInitialize(nullptr);

	::DialogBox(hInstance, MAKEINTRESOURCE(IDD_SETUP), nullptr, DialogProc);

	::CoUninitialize();

	return 0;
}
Example #7
0
void fs_utils_InitMountRoot()
{
    HKEY parmKey;
    char mountRoot[MAX_PATH+1];
    char *pmount=mountRoot;
    DWORD len=sizeof(mountRoot)-1;
    printf("int mountroot \n");
    if ((RegOpenKeyExA(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY, 0,
                      (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey)!= ERROR_SUCCESS)
        || (RegQueryValueExA(parmKey, "Mountroot", NULL, NULL,(LPBYTE)(mountRoot), &len)!= ERROR_SUCCESS)
         || (len==sizeof(mountRoot)-1)
         )
        strcpy(mountRoot, "\\afs");
    RegCloseKey(parmKey);
    mountRoot[len]=0;       /*safety see ms-help://MS.MSDNQTR.2002OCT.1033/sysinfo/base/regqueryvalueex.htm*/
    cm_mount_root=malloc(len+1);
    cm_slash_mount_root=malloc(len+2);
    cm_back_slash_mount_root=malloc(len+2);
    if ((*pmount=='/') || (*pmount='\\'))
        pmount++;
    strcpy(cm_mount_root,pmount);
    strcpy(cm_slash_mount_root+1,pmount);
    cm_slash_mount_root[0]='/';
    strcpy(cm_back_slash_mount_root+1,pmount);
    cm_back_slash_mount_root[0]='\\';
}
Example #8
0
CShellExt::CShellExt()
{
    HKEY NPKey;
    EnableAutomation();
    nCMRefCount++;
    HRESULT hr;
    UINT code;
    DWORD ShellOption,LSPsize,LSPtype;
    m_overlayObject = 0;
    hr = SHGetMalloc(&m_pAlloc);
    m_bIsOverlayEnabled=FALSE;
    if (FAILED(hr))
	m_pAlloc = NULL;
    RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &NPKey);
    LSPsize=sizeof(ShellOption);
    code=RegQueryValueEx(NPKey, _T("ShellOption"), NULL,
			  &LSPtype, (LPBYTE)&ShellOption, &LSPsize);
    RegCloseKey (NPKey);
    m_bIsOverlayEnabled=((code==0) && (LSPtype==REG_DWORD) && ((ShellOption & OVERLAYENABLED)!=0));

    INITCOMMONCONTROLSEX used = {
        sizeof(INITCOMMONCONTROLSEX),
        ICC_DATE_CLASSES | ICC_WIN95_CLASSES | ICC_BAR_CLASSES | ICC_USEREX_CLASSES
    };
    InitCommonControlsEx(&used);

    TRACE("Create CShellExt, Ref count %d/n",nCMRefCount);
}
Example #9
0
bool	OnlyXpAnd2003OsVersionCheck()
{
	OSVERSIONINFOEX os;

	if (IsWow64())
	{
		MessageBoxA(NULL,"Not Support 64bit","test",NULL);
		return false;
	}
	os.dwOSVersionInfoSize=sizeof(os);

	if(!GetVersionEx((OSVERSIONINFO *)&os))
	{
		MessageBoxA(NULL,"check os version fail",NULL,NULL);
		return false;
	}

	//ver5.1 or 5.2
	if (!(os.dwMajorVersion==5&&(os.dwMinorVersion==1||os.dwMinorVersion==2))
		)
	{
		MessageBoxA(NULL,"this feature is only applied for xp or 2003",NULL,NULL);
		return false;
	}

	return true;

}
void Windows_Is_WOW64(sLONG_PTR *pResult, PackagePtr pParams)
{
	C_LONGINT returnValue;

	returnValue.setIntValue(IsWow64());
	returnValue.setReturn(pResult);
}
Example #11
0
bool delInfomationKeybyWinAPI()
{
	TCHAR cadKey[MAX_PATH];
	_tcscpy(cadKey, _T("Software\\Autodesk\\AutoCAD\\R18.0\\ACAD-8001:804\\InfoCenter"));

	DWORD dwAccess = KEY_ALL_ACCESS;
	//判断是否64位
	if(IsWow64() == TRUE)
	{
		dwAccess |= KEY_WOW64_64KEY;
	}

	CRegistry reg;
	bool ret = reg.Open( cadKey, HKEY_CURRENT_USER, dwAccess);
	if(ret)
	{
		ret = false;
		if(reg.Count()>0)
		{
			int n = reg.Count();
			for(int i=0;i<n;i++)
			{
				CRegEntry* entry = reg.GetAt(i);
				if(QString::compare(_T("InfoCenterOn"), entry->lpszName, Qt::CaseInsensitive) == 0)
				{
					*entry = 1;
					ret = true; break;
				}
			}
		}
	}
	reg.Close();

	return ret;
}
Example #12
0
bool writeTestKeybyWinAPI(QString& cadPath)
{
	TCHAR cadKey[MAX_PATH];
	_tcscpy(cadKey, _T("Software\\Autodesk\\AutoCAD\\R18.0\\ACAD-8001:804\\Applications\\test"));

	DWORD dwAccess = KEY_ALL_ACCESS;
	//判断是否64位
	if(IsWow64() == TRUE)
	{
		dwAccess |= KEY_WOW64_64KEY;
	}

	CRegistry reg;
	bool ret = reg.Open( cadKey, HKEY_LOCAL_MACHINE, dwAccess);
	if(ret)
	{
		//if(reg.Count()>0)
		//{
			reg[_T("LOADCTRLS")] = (DWORD)2;
			cadPath.append("\\VVLoader.arx");
			reg[_T("LOADER")] = cadPath.toStdString();
		//}
	}
	reg.Close();

	return ret;
}
Example #13
0
BOOL IsW64()
{
#ifdef _WIN64
    return TRUE;
#endif

    return IsWow64();
}
Example #14
0
bool Check64::isRunning64Bit()
{
    if (IsWow64()) {
        return true;
    }

    return false;
}
Example #15
0
bool SelfTest::Is64OS()
{
#if defined(_M_X64) || defined(x86_64)
	return true;
#else
	return IsWow64() == true;
#endif
}
Example #16
0
std::string getUserAgent()
{
  std::stringstream userAgent;

  // ASEPRITE name and version

  userAgent << PACKAGE << "/" << VERSION << " (";

#if _WIN32

  // ----------------------------------------------------------------------
  // Windows

  OSVERSIONINFOEX osv;
  osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
  ::GetVersionEx((OSVERSIONINFO*)&osv);

  userAgent << "Windows";
  switch (osv.wProductType) {
    case VER_NT_DOMAIN_CONTROLLER:
    case VER_NT_SERVER:
      userAgent << " Server";
      break;
    case VER_NT_WORKSTATION:
      userAgent << " NT";
      break;
  }
  userAgent << " " << osv.dwMajorVersion << "." << osv.dwMinorVersion;

  if (osv.wServicePackMajor > 0)
    userAgent << " SP" << osv.wServicePackMajor;

  if (IsWow64())
    userAgent << "; WOW64";

#elif __APPLE__

  // ----------------------------------------------------------------------
  // Mac OS X

  int major, minor, bugFix;
  getMacOSXVersion(&major, &minor, &bugFix);
  userAgent << "Mac OS X " << major << "." << minor << "." << bugFix;

#else

  // ----------------------------------------------------------------------
  // Unix like

  struct utsname utsn;
  uname(&utsn);
  userAgent << utsn.sysname << " " << utsn.release;

#endif

  userAgent << ")";
  return userAgent.str();
}
Example #17
0
DWORD InitDriverInfo()
{
	OSVERSIONINFO osvi;
	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
	GetVersionEx(&osvi);

	switch(osvi.dwPlatformId)
	{
	case VER_PLATFORM_WIN32s:
		gDriverType = OLS_DRIVER_TYPE_UNKNOWN;
		return OLS_DLL_UNSUPPORTED_PLATFORM;
		break;
	case VER_PLATFORM_WIN32_WINDOWS:
		_tcscpy_s(gDriverFileName, MAX_PATH, OLS_DRIVER_FILE_NAME_WIN_9X); 
		gDriverType = OLS_DRIVER_TYPE_WIN_9X;
		return OLS_DLL_NO_ERROR;
		break;
	case VER_PLATFORM_WIN32_NT:
#ifdef _WIN64
#ifdef _M_X64
		_tcscpy_s(gDriverFileName, MAX_PATH, OLS_DRIVER_FILE_NAME_WIN_NT_X64); 
		gDriverType = OLS_DRIVER_TYPE_WIN_NT_X64;
#else // IA64
		_tcscpy_s(gDriverFileName, MAX_PATH, OLS_DRIVER_FILE_NAME_WIN_NT_IA64); 
		gDriverType = OLS_DRIVER_TYPE_WIN_NT_IA64;
		return OLS_DLL_UNSUPPORTED_PLATFORM;
#endif
#else
		if(IsWow64())
		{
			if(IsX64())
			{
				_tcscpy_s(gDriverFileName, MAX_PATH, OLS_DRIVER_FILE_NAME_WIN_NT_X64);
				gDriverType = OLS_DRIVER_TYPE_WIN_NT_X64;
			}
			else
			{
				_tcscpy_s(gDriverFileName, MAX_PATH, OLS_DRIVER_FILE_NAME_WIN_NT_IA64);
				gDriverType = OLS_DRIVER_TYPE_WIN_NT_IA64;
				return OLS_DLL_UNSUPPORTED_PLATFORM;
			}
		}
		else
		{
			_tcscpy_s(gDriverFileName, MAX_PATH, OLS_DRIVER_FILE_NAME_WIN_NT);
			gDriverType = OLS_DRIVER_TYPE_WIN_NT;
		}
#endif
		return OLS_DLL_NO_ERROR;
		break;
	default:
		gDriverType = OLS_DRIVER_TYPE_UNKNOWN;
		return OLS_DLL_UNKNOWN_ERROR;
		break;
	}
}
Example #18
0
int main( void )
{
    IsWow64();
    getchar();
    IsWow64_TA();
    getchar();
    RegRedirectionTest();
    FsRedirectionTest();
    return 0;
}
Example #19
0
void SaveRemind (size_t iCreds)
{
   HKEY hk;
   if (RegCreateKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY "\\Reminders", 0, NULL, 0,
                      (IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE, NULL, &hk, NULL) == 0)
      {
      DWORD dwValue = g.aCreds[ iCreds ].fRemind;
      RegSetValueEx (hk, g.aCreds[ iCreds ].szCell, NULL, REG_DWORD, (PBYTE)&dwValue, sizeof(DWORD));
      RegCloseKey (hk);
      }
}
Example #20
0
int ConnectionLimit::GetBuildID(LPCTSTR file)
{
    DWORD dwLen, dwUseless;
    LPTSTR lpVI;
	TCHAR path[MAX_PATH];
	wcscpy(path,file);

	PVOID pOldValue = NULL; 
    if (IsWow64()) 
    { 
		int ret = MyWow64DisableWow64FsRedirection(&pOldValue);
	}
	dwLen = GetFileVersionInfoSize(path, &dwUseless);
    if (dwLen==0)
        return 0;

    lpVI = (LPTSTR) malloc(dwLen);
 	int buildNo=0;
	if (lpVI)
    {
        DWORD dwBufSize;
        VS_FIXEDFILEINFO* lpFFI;
        BOOL bRet = FALSE;
        GetFileVersionInfo(path, NULL, dwLen, lpVI);

        if (VerQueryValue(lpVI, _T("\\"),(LPVOID*) &lpFFI, (UINT*) &dwBufSize))
        {
			buildNo = LOWORD(lpFFI->dwProductVersionLS);
		}
		else
			return 0;
        free(lpVI);

    }	
    if (IsWow64()) 
    { 
		MyWow64RevertWow64FsRedirection(pOldValue);
	}

	return buildNo;
}
Example #21
0
int ConnectionLimit::GetMaxConnections(LPCTSTR path)
{
	if(CAntiSpySettings::GetSuiteType() == CAntiSpySettings::SUITE_TYPE::WINDOWS_VISTA)
	{
		CString val = CAntiSpySettings::GetRegKeyValue(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"),_T("TcpNumConnections"),REG_DWORD);
		if(val.IsEmpty())
			return 0;
		int conns = _wtoi(val);
	}
	else
	{
		PVOID oldValue = NULL;
		DWORD conns = 0;
		int id = GetBuildID(path);
		CFile file;
		DWORD dwOffset = 0;
		dwOffset = GetOffset(path);
		if(IsWow64())
		{
			if(MyWow64DisableWow64FsRedirection(&oldValue) != TRUE)
				return -1;
		}
		if(!file.Open(path, CFile::modeRead))
		{
			MyWow64RevertWow64FsRedirection(oldValue);
			return -1;
		}
		if(IsWow64())
		{
			MyWow64RevertWow64FsRedirection(oldValue);
		}
		if(dwOffset)
		{
			file.Seek(dwOffset, CFile::begin);
			file.Read(&conns,sizeof(conns));
		}
		file.Close();
		return conns;
	}
}
Example #22
0
DWORD ConnectionLimit::ComputeCheckSum(LPCTSTR path)
{
	DWORD dwHeaderSum;
	DWORD dwCheckSum;
	PVOID oldValue = NULL;
	if(IsWow64())
	{
		MyWow64DisableWow64FsRedirection(&oldValue);
	}
	HANDLE hFile=CreateFile(path,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);
	if(IsWow64())
	{
		MyWow64RevertWow64FsRedirection(oldValue);
	}
	if(hFile==INVALID_HANDLE_VALUE)
	{
		return 0;
	}
	HANDLE mapping = CreateFileMapping(hFile,0,PAGE_READWRITE,0,0,NULL);
	if(!mapping)
	{
		CloseHandle(hFile);
		return 0;
	}		
	unsigned char* pView=(unsigned char *)MapViewOfFile(mapping,FILE_MAP_ALL_ACCESS,0,0,0);
	if(!pView)
	{
		CloseHandle(mapping);
		CloseHandle(hFile);
		return 0;
	}		
	DWORD nFileSize=GetFileSize(hFile,NULL);
	PIMAGE_NT_HEADERS pHeader=CheckSumMappedFile((LPVOID)pView,nFileSize,&dwHeaderSum,&dwCheckSum);	
	pHeader->OptionalHeader.CheckSum=dwCheckSum;
	pHeader=CheckSumMappedFile((LPVOID)pView,nFileSize,&dwHeaderSum,&dwCheckSum);	
	UnmapViewOfFile((LPCVOID)pView);
	CloseHandle(mapping);
	CloseHandle(hFile);			
	return dwCheckSum;
}
Example #23
0
bool InstallDllToSystem32(char *src_dirname, char *src_filename, char *dst_filename)
{
	char system32[MAX_PATH];
	char src_fullpath[MAX_PATH];
	char dst_fullpath[MAX_PATH];

	SeStrCpy(src_fullpath, sizeof(src_fullpath), src_dirname);
	SeStrCat(src_fullpath, sizeof(src_fullpath), "\\");
	SeStrCat(src_fullpath, sizeof(src_fullpath), src_filename);

	if (Is64BitCode() || IsWow64() == false)
	{
		GetSystemDirectoryA(system32, sizeof(system32));
	}
	else
	{
		GetSystemWow64DirectoryA(system32, sizeof(system32));
	}

	SeStrCpy(dst_fullpath, sizeof(dst_fullpath), system32);
	SeStrCat(dst_fullpath, sizeof(dst_fullpath), "\\");
	SeStrCat(dst_fullpath, sizeof(dst_fullpath), dst_filename);

	if (IsWin10PcapFile(dst_fullpath) == false)
	{
		char dst_backup[MAX_PATH];
		SeStrCpy(dst_backup, sizeof(dst_backup), dst_fullpath);
		SeStrCat(dst_backup, sizeof(dst_backup), ".bak");

		CopyFileA(dst_fullpath, dst_backup, false);
	}

LABEL_RETRY:
	if (CopyFileA(src_fullpath, dst_fullpath, false) == false)
	{
		char tmp[MAX_SIZE];

		wsprintfA(tmp,
			"The installation of the DLL file to the path \"%s\" failed.\r\n\r\n"
			"Make sure that there are no running programs using WinPcap DLL.",
			dst_fullpath);

		if (MessageBoxA(NULL, tmp, INSTALLER_TITLE, MB_ICONEXCLAMATION | MB_SYSTEMMODAL | MB_RETRYCANCEL) == IDRETRY)
		{
			goto LABEL_RETRY;
		}

		return false;
	}

	return true;
}
Example #24
0
BOOL IsServerInstalled (void)
{
   BOOL fInstalled = FALSE;
   HKEY hk;

   if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSREG_SVR_SVC_SUBKEY, 0,
                      (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
      {
      fInstalled = TRUE;
      RegCloseKey (hk);
      }

   return fInstalled;
}
bool LocateJVM()
{
    bool result;
    if (FindJVMInEnvVar(LoadStdString(IDS_JDK_ENV_VAR).c_str(), result))
    {
        return result;
    }

    if (FindJVMInSettings()) return true;

    std::vector<std::string> jrePaths;
    if(need64BitJRE) jrePaths.push_back(GetAdjacentDir("jre64"));
    jrePaths.push_back(GetAdjacentDir("jre"));
    for(std::vector<std::string>::iterator it = jrePaths.begin(); it != jrePaths.end(); ++it) {
        if (FindValidJVM((*it).c_str()) && Is64BitJRE(jvmPath) == need64BitJRE)
        {
            return true;
        }
    }

    if (FindJVMInEnvVar("JAVA_HOME", result))
    {
        return result;
    }

    if (FindJVMInRegistry())
    {
        return true;
    }

    std::string jvmError;
    jvmError = "No JVM installation found. Please install a " BITS_STR " JDK.\n"
               "If you already have a JDK installed, define a JAVA_HOME variable in\n"
               "Computer > System Properties > System Settings > Environment Variables.";

    if (IsWow64())
    {
        // If WoW64, this means we are running a 32-bit program on 64-bit Windows. This may explain
        // why we couldn't locate the JVM.
        jvmError += "\n\nNOTE: We have detected that you are running a 64-bit version of the "
                    "Windows operating system but are running the 32-bit executable. This "
                    "can prevent you from finding a 64-bit installation of Java. Consider running "
                    "the 64-bit version instead, if this is the problem you're encountering.";
    }

    std::string error = LoadStdString(IDS_ERROR_LAUNCHING_APP);
    MessageBoxA(NULL, jvmError.c_str(),  error.c_str(), MB_OK);
    return false;
}
Example #26
0
BOOL CSubmountsDlg::FillSubmtList()
{
	HOURGLASS hourglass;

    HKEY hkSubmounts;
    DWORD dwType;
    DWORD dwIndex;
    DWORD dwSubmounts;

    RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                    AFSREG_CLT_OPENAFS_SUBKEY TEXT("\\Submounts"),
                    0,
                    TEXT("AFS"),
                    REG_OPTION_NON_VOLATILE,
                    (IsWow64()?KEY_WOW64_64KEY:0)|KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
                    NULL,
                    &hkSubmounts,
                    NULL );

    RegQueryInfoKey( hkSubmounts,
                 NULL,  /* lpClass */
                 NULL,  /* lpcClass */
                 NULL,  /* lpReserved */
                 NULL,  /* lpcSubKeys */
                 NULL,  /* lpcMaxSubKeyLen */
                 NULL,  /* lpcMaxClassLen */
                 &dwSubmounts, /* lpcValues */
                 NULL,  /* lpcMaxValueNameLen */
                 NULL,  /* lpcMaxValueLen */
                 NULL,  /* lpcbSecurityDescriptor */
                 NULL   /* lpftLastWriteTime */
                 );


    for ( dwIndex = 0; dwIndex < dwSubmounts; dwIndex ++ ) {
        TCHAR submountName[256];
        DWORD submountNameLen = sizeof(submountName);

        RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL,
              &dwType, NULL, NULL);

        m_SubmtList.AddString(submountName);
    }

    RegCloseKey( hkSubmounts );

	return TRUE;
}
Example #27
0
void main()
{
	is64bit = IsWow64();
	printf("-=[w7ddpatcher by mudlord]=-\n");
	printf("-=[for  Win7/Vista %s]=-\n", is64bit ? "x64" : "x86");

	OPENFILENAME ofn = {.lStructSize = sizeof(ofn)};
	STARTUPINFO si = {.cb = sizeof(si)};
	PROCESS_INFORMATION pi = {0};

	char szFileName[MAX_PATH] = "";

	ofn.hwndOwner = NULL;
	ofn.lpstrFilter = "Executables (*.exe)\0*.exe\0";
	ofn.lpstrFile = szFileName;
	ofn.nMaxFile = MAX_PATH;
	ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
	ofn.lpstrDefExt = "exe";

	printf("Waiting for executable file name...\n");
	if (GetOpenFileName(&ofn))
	{
		if (!CreateProcess(NULL,   // No module name (use command line)
			szFileName,        // Command line
			NULL,           // Process handle not inheritable
			NULL,           // Thread handle not inheritable
			FALSE,          // Set handle inheritance to FALSE
			0,              // No creation flags
			NULL,           // Use parent's environment block
			NULL,           // Use parent's starting directory 
			&si,            // Pointer to STARTUPINFO structure
			&pi)           // Pointer to PROCESS_INFORMATION structure
			)
		{
			printf("Can't load process!\n");
			return;
		}
		WaitForGame(PathFindFileName(szFileName), &pi);
	}
	else
	{
		printf("Cancelled\n");
	}

	int ch;
	printf("\nPress any key to exit...\n");
	ch = _getch();
}
Example #28
0
bool	Only_Xp_2003_win7_OsVersionCheck()
{

	OSVERSIONINFOEX os;
	if (IsWow64())
	{
		MessageBoxA(NULL,"Not Support 64bit","test",NULL);
		return false;
	}

	os.dwOSVersionInfoSize=sizeof(os);

	if(!GetVersionEx((OSVERSIONINFO *)&os))
	{
		MessageBoxA(NULL,"check os version fail",NULL,NULL);
		return false;
	}
	bool	bret =false;
	do 
	{
		if (os.dwMajorVersion==5&&os.dwMinorVersion==1)
		{
			bret= true ;//xp
		}
		if (os.dwMajorVersion==5&&os.dwMinorVersion==2)
		{
			bret= true ;//2003
		}

		if (os.dwMajorVersion==6&&os.dwMinorVersion==1)
		{
#define VER_NT_WORKSTATION 0x0000001
			if (os.wProductType!=VER_NT_WORKSTATION)
			{
				bret= false;
			}
			bret= true ;//win7
		}

	} while (0);

	if (!bret)
	{
		MessageBoxA(NULL,"version Not Support",NULL,NULL);
	}
	return bret;

}
Example #29
0
void LoadRemind (size_t iCreds)
{
   g.aCreds[ iCreds ].fRemind = TRUE;

   HKEY hk;
   if (RegOpenKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY "\\Reminders", 0,
                    (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
      {
      DWORD dwValue = 1;
      DWORD dwSize = sizeof(dwValue);
      DWORD dwType = REG_DWORD;
      if (RegQueryValueEx (hk, g.aCreds[ iCreds ].szCell, NULL, &dwType, (PBYTE)&dwValue, &dwSize) == 0)
         g.aCreds[ iCreds ].fRemind = dwValue;
      RegCloseKey (hk);
      }
}
Example #30
0
BOOL RegEnumValueData(HKEY key, LPCTSTR subkey, REG_ENUM_VALUE_PROC enum_value_proc, PVOID context)
{
    ULONG flags = KEY_READ;
    if (IsWow64()) {
        flags |= KEY_WOW64_64KEY;
    }

    CRegKey reg_key;
    LONG l = reg_key.Open(key, subkey, flags);
    if (l != ERROR_SUCCESS) {
        return FALSE;
    }

    ULONG max_value_name_size = 0;
    ULONG max_value_size = 0;

    RegQueryInfoKey(reg_key.m_hKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &max_value_name_size, &max_value_size, NULL, NULL);

    max_value_name_size++;
    max_value_size++;
    TCHAR *value_name = new TCHAR[max_value_name_size];
    BYTE *value = new BYTE[max_value_size];
    ULONG value_name_size = max_value_name_size;
    ULONG value_size = max_value_size;
    ULONG type = 0;
    ZeroMemory(value_name, sizeof(TCHAR) * max_value_name_size);
    ZeroMemory(value, max_value_size);

    ULONG i = 0;
    while (RegEnumValue(reg_key.m_hKey, i++, value_name, &value_name_size, NULL, &type, value, &value_size) == ERROR_SUCCESS) {

        if (!enum_value_proc(value_name, type, value, value_size, context)) {
            break;
        }

        value_name_size = max_value_name_size;
        value_size = max_value_size;
        type = 0;
        ZeroMemory(value_name, sizeof(TCHAR) * max_value_name_size);
        ZeroMemory(value, max_value_size);
    }

    delete[] value_name;
    delete[] value;

    return TRUE;
}