Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than cfgmgr32, prefix the name with the module name and a period.
DEVPROPKEY key = ...;
uint propertyType;
uint propBufSize = 0;
byte[] buffer = null;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, buffer, ref propBufSize, 0);
if (result != ConfigManagerResult.BufferSmall) {
throw new Exception(string.Format("Failed to retrieve property size for property {0} {1}: {2}.",
key._guid, key._pid, result));
}
object value;
switch (propertyType) {
case 0x02:
sbyte v;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out v, ref propBufSize, 0);
value = v;
break;
case 0x03:
byte b;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out b, ref propBufSize, 0);
value = b;
break;
case 0x04:
short s;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out s, ref propBufSize, 0);
value = s;
break;
case 0x05:
ushort us;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out us, ref propBufSize, 0);
value = us;
break;
case 0x06:
int i;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out i, ref propBufSize, 0);
value = i;
break;
case 0x07:
uint ui;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out ui, ref propBufSize, 0);
value = ui;
break;
case 0x08:
long l;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out l, ref propBufSize, 0);
value = l;
break;
case 0x09:
ulong ul;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out ul, ref propBufSize, 0);
value = ul;
break;
case 0x0A:
float f;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out f, ref propBufSize, 0);
value = f;
break;
case 0x0B:
double d;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out d, ref propBufSize, 0);
value = d;
break;
case 0x0C:
decimal dec;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out dec, ref propBufSize, 0);
value = dec;
break;
case 0x0D:
Guid guid;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out guid, ref propBufSize, 0);
value = guid;
break;
case 0x11:
bool bo;
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, out bo, ref propBufSize, 0);
value = bo;
break;
case 0x12:
var builder = new StringBuilder((int)propBufSize);
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, builder, ref propBufSize, 0);
value = builder;
break;
default:
buffer = new byte[propBufSize];
result = CM_Get_DevNode_Property(devInst, ref key, out propertyType, buffer, ref propBufSize, 0);
value = "a buffer";
break;
}
if (result != ConfigManagerResult.Success) {
throw new Exception("Failed to retrieve property: " + result + ".");
}
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).