我想在windows ddk 7軟件包中使用offreg.dll在內存中創建一個脫機註冊表。ERROR_MORE_DATA ----從註冊表中讀取
你可以找到在這裏offreg.dll的更多信息:MSDN
目前,在試圖從一個打開的註冊表配置單元/鍵我收到以下錯誤讀取值:234或ERROR_MORE_DATA
這裏是包含ORGetValue的.H代碼:
DWORD
ORAPI
ORGetValue (
__in ORHKEY Handle,
__in_opt PCWSTR lpSubKey,
__in_opt PCWSTR lpValue,
__out_opt PDWORD pdwType,
__out_bcount_opt(*pcbData) PVOID pvData,
__inout_opt PDWORD pcbData
);
這裏是我使用提取數據的代碼
[DllImport("offreg.dll", CharSet = CharSet.Auto, EntryPoint = "ORGetValue", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
public static extern uint ORGetValue(IntPtr Handle, string lpSubKey, string lpValue, out uint pdwType, out string pvData, out uint pcbData);
IntPtr myHive;
IntPtr myKey;
string myValue;
uint pdwtype;
uint pcbdata;
uint ret3 = ORGetValue(myKey, "", "DefaultUserName", out pdwtype, out myValue, out pcbdata);
目標是能夠將myValue作爲字符串讀取。
我不確定是否需要使用封送......或者第二次調用緩衝區調用..或者真的如何調整C#中的緩衝區。任何幫助或指針將不勝感激。
謝謝。
不太確定代碼中會出現什麼樣子,使用我上面的示例,您能否偶然演示一個演示? 謝謝。 – user314749 2010-04-12 19:13:47
順便說一下,buffer.Append(「DefaultUserName」);不需要。 – user314749 2010-04-12 20:03:27