Registry key handle synchronization question

Hi Everyone,

I have a question regarding registry key handle synchronization. If the code
below is called from multiple threads at the same time do i need to
synchronize it because i am using globalRootKeyHandle? (globalRootKeyHandle
is a global handle to the registry key i open during driver initialization)

InitializeObjectAttributes(
&objectAttributes,
KeyName,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
globalRootKeyHandle,
NULL);

funcStatus = ZwCreateKey(
KeyHandle,
KEY_ALL_ACCESS,
&objectAttributes,
0,
NULL,
REG_OPTION_NON_VOLATILE,
&creationDisposition);

Thanks

Pankaj Garg
This posting is provided “AS IS” with no warranties and confers no rights.

KeyHandle is the memory location that needs potential synchronization.
If KeyHandle is only scoped to the calling thread (ie it is a local or a
part of your device extension which is initialized during AddDevice or
initial START_DEVICE processing), you don’t need to synchronize
anything.

This assumes that globalRootKeyHandle is closed during your Unload
routine. If so, globalRootKeyHandle will not be affected by the call to
ZwCreateKey when using it in the object attributes.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Tuesday, June 14, 2005 4:58 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Registry key handle synchronization question

Hi Everyone,

I have a question regarding registry key handle synchronization. If the
code
below is called from multiple threads at the same time do i need to
synchronize it because i am using globalRootKeyHandle?
(globalRootKeyHandle
is a global handle to the registry key i open during driver
initialization)

InitializeObjectAttributes(
&objectAttributes,
KeyName,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
globalRootKeyHandle,
NULL);

funcStatus = ZwCreateKey(
KeyHandle,
KEY_ALL_ACCESS,
&objectAttributes,
0,
NULL,
REG_OPTION_NON_VOLATILE,
&creationDisposition);

Thanks

Pankaj Garg
This posting is provided “AS IS” with no warranties and confers no
rights.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thank you for the information. This means i don’t need any synchronization
because i open the handle to the RegistryKey"\Parameter" supplied in
DriverEntry in the DriverEntry function itself and close it only in the
Unload handler when the driver is unloading.


Pankaj Garg
This posting is provided “AS IS” with no warranties and confers no rights.

“Doron Holan” wrote in message
news:xxxxx@ntdev…
KeyHandle is the memory location that needs potential synchronization.
If KeyHandle is only scoped to the calling thread (ie it is a local or a
part of your device extension which is initialized during AddDevice or
initial START_DEVICE processing), you don’t need to synchronize
anything.

This assumes that globalRootKeyHandle is closed during your Unload
routine. If so, globalRootKeyHandle will not be affected by the call to
ZwCreateKey when using it in the object attributes.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Tuesday, June 14, 2005 4:58 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Registry key handle synchronization question

Hi Everyone,

I have a question regarding registry key handle synchronization. If the
code
below is called from multiple threads at the same time do i need to
synchronize it because i am using globalRootKeyHandle?
(globalRootKeyHandle
is a global handle to the registry key i open during driver
initialization)

InitializeObjectAttributes(
&objectAttributes,
KeyName,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
globalRootKeyHandle,
NULL);

funcStatus = ZwCreateKey(
KeyHandle,
KEY_ALL_ACCESS,
&objectAttributes,
0,
NULL,
REG_OPTION_NON_VOLATILE,
&creationDisposition);

Thanks

Pankaj Garg
This posting is provided “AS IS” with no warranties and confers no
rights.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com