Minidrv problem

I am writting minidrv about camera,and now i encounted one problem.

NTSTATUS Initialize( PDEVICE_OBJECT BusDeviceObject,PVOID DeviceContext )
{

UNICODE_STRING RegPath;
ULONG Value;
WCHAR BasePath = L"\Registry\MACHINE\SOFTWARE\CA561A\HWSTATE";

RegPath.Buffer = BasePath;
RegPath.MaximumLength = sizeof (BasePath + 32);
RegPath.Length = 0;
Value=(ULONG)1;

ntStatus =
RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,RegPath.Buffer,L"HwState",REG_DWORD,

Value,sizeof (ULONG));

}

I just write one key in registry,but if it was built it in Win98,it can’t
run in Win2000 and WinXP.
and i didn’t modified any code, built it in Win2000,it run OK.
Can anyone tell me why? if i can’t write registy in Initialize(), Thanks!