Accessing 64 bit registry from a 32 bit process
As you may know, Windows is virtualizing some parts of the registry under 64 bit. So if you try to open, for example, this key : “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90″, from a 32 bit C# application running on a 6
As you may know, Windows is virtualizing some parts of the registry under 64 bit.
So if you try to open, for example, this key : “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90″, from a 32 bit C# application running on a 64 bit system, you will be redirected to : “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\90″
Why ? Because Windows uses the Wow6432Node registry entry to present a separate view of HKEY_LOCAL_MACHINE\SOFTWARE for 32 bit applications that runs on a 64 bit systems.
If you want to explicitly open the 64 bit view of the registry, here is what you have to perform :
You are using VS 2010 and version 4.x of the .NET framework
It’s really simple, all you need to do is, instead of doing :
//Will redirect you to the 32 bit view
RegistryKey sqlsrvKey = Registry.LocalMachine.OpenSubKey(
@"SOFTWARE\Microsoft\Microsoft SQL Server\90"
);
do the following :
RegistryKey localMachineX64View = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
RegistryKey sqlsrvKey = localMachineX64View.OpenSubKey(
@"SOFTWARE\Microsoft\Microsoft SQL Server\90"
);
Prior versions of the .NET framework
For the prior versions of the framework, we have to use P/Invoke and call the function RegOpenKeyExW with parameter KEY_WOW64_64KEY
enum
RegWow64Options
{
None = 0,
KEY_WOW64_64KEY = 0x0100,
KEY_WOW64_32KEY = 0x0200
}
enum
RegistryRights
{
ReadKey = 131097,
WriteKey = 131078
}
/// <summary></summary>
/// Open a registry key using the Wow64 node instead of the default 32-bit node.
///
/// <param name="parentKey">Parent key to the key to be opened.
/// <param name="subKeyName">Name of the key to be opened
/// <param name="writable">Whether or not this key is writable
/// <param name="options">32-bit node or 64-bit node
/// <returns></returns>
static
RegistryKey _openSubKey(RegistryKey parentKey,
string
subKeyName,
bool
writable, RegWow64Options options)
{
//Sanity check
if
(parentKey ==
null
|| _getRegistryKeyHandle(parentKey) == IntPtr.Zero)
{
return
null
;
}
//Set rights
int
rights = (
int
)RegistryRights.ReadKey;
if
(writable)
rights = (
int
)RegistryRights.WriteKey;
//Call the native function >.
int
subKeyHandle, result = RegOpenKeyEx(_getRegistryKeyHandle(parentKey), subKeyName, 0, rights | (
int
)options,
out
subKeyHandle);
//If we errored, return null
if
(result != 0)
{
return
null
;
}
//Get the key represented by the pointer returned by RegOpenKeyEx
RegistryKey subKey = _pointerToRegistryKey((IntPtr)subKeyHandle, writable,
false
);
return
subKey;
}
/// <summary></summary>
/// Get a pointer to a registry key.
///
/// <param name="registryKey">Registry key to obtain the pointer of.
/// <returns>Pointer to the given registry key.</returns>
static
IntPtr _getRegistryKeyHandle(RegistryKey registryKey)
{
//Get the type of the RegistryKey
Type registryKeyType =
typeof
(RegistryKey);
//Get the FieldInfo of the 'hkey' member of RegistryKey
System.Reflection.FieldInfo fieldInfo =
registryKeyType.GetField(
"hkey"
, System.Reflection.BindingFlags.NonPublic
| System.Reflection.BindingFlags.Instance);
//Get the handle held by hkey
SafeHandle handle = (SafeHandle)fieldInfo.GetValue(registryKey);
//Get the unsafe handle
IntPtr dangerousHandle = handle.DangerousGetHandle();
return
dangerousHandle;
}
/// <summary></summary>
/// Get a registry key from a pointer.
///
/// <param name="hKey">Pointer to the registry key
/// <param name="writable">Whether or not the key is writable.
/// <param name="ownsHandle">Whether or not we own the handle.
/// <returns>Registry key pointed to by the given pointer.</returns>
static
RegistryKey _pointerToRegistryKey(IntPtr hKey,
bool
writable,
bool
ownsHandle)
{
//Get the BindingFlags for private contructors
System.Reflection.BindingFlags privateConstructors = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic;
//Get the Type for the SafeRegistryHandle
Type safeRegistryHandleType =
typeof
(Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid).Assembly.GetType(
"Microsoft.Win32.SafeHandles.SafeRegistryHandle"
);
//Get the array of types matching the args of the ctor we want
Type[] safeRegistryHandleCtorTypes =
new
Type[] {
typeof
(IntPtr),
typeof
(
bool
) };
//Get the constructorinfo for our object
System.Reflection.ConstructorInfo safeRegistryHandleCtorInfo = safeRegistryHandleType.GetConstructor(
privateConstructors,
null
, safeRegistryHandleCtorTypes,
null
);
//Invoke the constructor, getting us a SafeRegistryHandle
Object safeHandle = safeRegistryHandleCtorInfo.Invoke(
new
Object[] { hKey, ownsHandle });
//Get the type of a RegistryKey
Type registryKeyType =
typeof
(RegistryKey);
//Get the array of types matching the args of the ctor we want
Type[] registryKeyConstructorTypes =
new
Type[] { safeRegistryHandleType,
typeof
(
bool
) };
//Get the constructorinfo for our object
System.Reflection.ConstructorInfo registryKeyCtorInfo = registryKeyType.GetConstructor(
privateConstructors,
null
, registryKeyConstructorTypes,
null
);
//Invoke the constructor, getting us a RegistryKey
RegistryKey resultKey = (RegistryKey)registryKeyCtorInfo.Invoke(
new
Object[] { safeHandle, writable });
//return the resulting key
return
resultKey;
}
[DllImport(
"advapi32.dll"
, CharSet = CharSet.Auto)]
public
static
extern
int
RegOpenKeyEx(IntPtr hKey,
string
subKey,
int
ulOptions,
int
samDesired,
out
int
phkResult);
Then we can open our registry key like this :
RegistryKey sqlsrvKey = _openSubKey(Registry.LocalMachine,
@"SOFTWARE\Microsoft\Microsoft SQL Server\90"
,
false
, RegWow64Options.KEY_WOW64_64KEY);
As you can see, the framework 4 make our life easier.
Referenced from: http://dotnetgalactics.wordpress.com/2010/05/10/accessing-64-bit-registry-from-a-32-bit-process/

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

PR의 정식 명칭은 "Adobe Premiere Pro"입니다. PR은 Adobe에서 개발한 비디오 편집 소프트웨어로, Adobe에서 출시한 다른 소프트웨어와 협력할 수 있어 광고 제작 및 TV 프로그램 제작에 널리 사용됩니다.

PR에 오디오 트랙이 있지만 사운드가 없습니다. 1. PR 애플리케이션에서 자료를 타임라인으로 드래그합니다. 2. 편집 메뉴에서 기본 설정을 엽니다. 3. 기본 설정 창에서 오디오 하드웨어 항목 표시줄을 엽니다. 4. 옵션 상자에서 스피커 옵션을 찾아 확인 버튼을 클릭합니다. 5. PR 애플리케이션으로 돌아가서 비디오 미리보기 창에서 재생하면 사운드가 방송됩니다.

1비트는 1/8바이트와 같습니다. 이진수 체계에서 0 또는 1 각각은 비트(bit)이고, 비트는 데이터 저장의 가장 작은 단위이며, 8비트(bit, 약칭 b)마다 바이트(Byte)를 구성하므로 "1바이트( 바이트) = 8비트”. 대부분의 컴퓨터 시스템에서 바이트는 8비트 길이의 데이터 단위입니다. 대부분의 컴퓨터는 바이트를 사용하여 문자, 숫자 또는 기타 문자를 나타냅니다.

지원되지 않는 압축 유형의 PR 파일에 대한 이유 및 해결 방법: 1. 간소화된 PR 버전은 많은 비디오 인코더를 간소화했습니다. Premiere의 정식 버전을 다시 설치하고 사용하세요. 2. 불규칙한 비디오 인코딩으로 인해 형식 팩토리를 사용하여 변환할 수 있습니다. 비디오를 WMV 형식으로 변환합니다.

PR에서 비디오를 편집할 때 발생하는 오류 해결 방법: 1. 컴퓨터에서 Premiere 사후 편집 소프트웨어를 열고 프로젝트 설정의 오른쪽 메뉴 표시줄에서 "일반"을 선택합니다. 2. Premiere의 일반 설정 창으로 들어가서 "Mercury only" 재생 엔진 소프트웨어"를 선택하십시오. 3. PR에서 비디오를 편집할 때 오류를 해결하려면 "확인"을 클릭하십시오.

홍보 자막이 그대로 표시되는 방법: 1. 자막 텍스트 추가 3. 지속 시간 조정 5. 애니메이션 효과 조정 6. . 비디오를 미리 보고 내보낼 수 있습니다.

PR 외부 슬라이딩 도구는 홍보 실무자가 PR 작업을 더 잘 수행하도록 돕는 데 사용됩니다. 1. 홍보 실무자가 미디어 모니터링 및 분석을 수행하도록 지원합니다. 2. 홍보 실무자가 여론 모니터링 및 분석을 수행하도록 지원합니다. 홍보 전문가 실무자는 미디어 관계 관리를 수행합니다. 4. 홍보 실무자가 보도 자료를 작성하고 출판하도록 돕습니다. 5. 홍보 실무자가 데이터 분석 및 보고서 생성을 수행하도록 돕습니다.

1. 키보드의 [Win+R] 단축키 조합을 길게 눌러 [실행] 대화상자 명령창을 열고, [services.msc] 명령을 입력한 후 [확인];을 클릭하세요. 2. 서비스 인터페이스를 연 후 [RemoteRegistry] 옵션을 찾아 왼쪽 버튼을 두 번 클릭하여 속성 대화 상자 창을 엽니다. 3. [원격 레지스트리 속성] 대화창이 열리면 시작 유형 옵션에서 [사용 안 함] 옵션을 선택한 후 [적용]--[중지]-[확인] 버튼을 클릭하여 설정을 저장합니다.
