I will try to repro locally…BUT, you should really not be touching the registry in the power up/down path. Registry is slow, you want the power up path to be as fast as possible so that your device is up and running and the user gets their machine back quickly
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@imaginando.net
Sent: Thursday, May 03, 2012 9:44 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] DECLARE_CONST_UNICODE_STRING & WINDDK 8
Doron,
Thanks for your reply. However, it keeps complaining about the same error. Let me expose this detailed as possible:
This is file usb.c and the function is
NTSTATUS DpxMttEvtDeviceD0Entry(IN WDFDEVICE Device, IN WDF_POWER_DEVICE_STATE PreviousState);
I have DPX_DEVICE_STATE_REGISTRY defined in an header file in the following way:
#define DPX_DEVICE_STATE_REGISTRY L"DPX_DEVICE_STATE"
That header includes already wdf.h and ntddk.h, my code had always the semicolon.
When I call the MACRO i’m doing it in the following way:
NTSTATUS DpxMttEvtDeviceD0Entry(IN WDFDEVICE Device, IN WDF_POWER_DEVICE_STATE PreviousState) {
PDEVICE_EXTENSION devContext = NULL;
NTSTATUS status = STATUS_SUCCESS;
WDF_OBJECT_ATTRIBUTES attributes;
UNREFERENCED_PARAMETER(PreviousState);
DECLARE_CONST_UNICODE_STRING(dpxState, DPX_DEVICE_STATE_REGISTRY);
status = WdfDeviceOpenRegistryKey(Device, PLUGPLAY_REGKEY_DEVICE, STANDARD_RIGHTS_ALL, WDF_NO_OBJECT_ATTRIBUTES, &hKey);
if (NT_SUCCESS (status))
{
//
// Getting dpx state persisted registry value
//
status = WdfRegistryQueryValue(hKey,&dpxState,sizeof(DPX_DEVICE_STATE),&devContext->Context.State,NULL,NULL);
if (!NT_SUCCESS (status))
{
KdPrint((“failed to restore previous dpx state”));
}
}
WdfRegistryClose(hKey);
}
I had this code working perfectly on WINDDK 7.
I’m only having this problem since porting to WINDDK 8 inside Visual Studio 11 Beta
The compiler says the following:
1>usb.c(642): error C2143: syntax error : missing ‘;’ before ‘type’
1>usb.c(642): error C2143: syntax error : missing ‘;’ before ‘const’
None of the present solutions result in success so far…
Thanks for your time,
With my best regards,
Nuno Santos
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer