Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8025123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:03:56+00:00 2026-06-04T23:03:56+00:00

DWORD OREnumKey( __in ORHKEY Handle, __in DWORD dwIndex, __out PWSTR lpName, __inout PDWORD lpcName,

  • 0
   DWORD OREnumKey(
      __in         ORHKEY Handle,
      __in         DWORD dwIndex,
      __out        PWSTR lpName,
      __inout      PDWORD lpcName,
      __out_opt    PWSTR lpClass,
      __inout_opt  PDWORD lpcClass,
      __out_opt    PFILETIME lpftLastWriteTime
    );

My code

[DllImport("offreg.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern uint OREnumKey(IntPtr Handle, IntPtr dwIndex, [MarshalAs(UnmanagedType.LPWStr)]out StringBuilder lpName, ref IntPtr lpcName, [MarshalAs(UnmanagedType.LPWStr)]out StringBuilder lpClass, ref IntPtr lpcClass, out System.Runtime.InteropServices.ComTypes.FILETIME lpftLastWriteTime);
 IntPtr myKey = hiveid;
    IntPtr dwindex=(IntPtr)0;
    StringBuilder lpName=new StringBuilder("",255);
    IntPtr lpcName = (IntPtr)0;
    StringBuilder  lpClass=new StringBuilder("",255);
    IntPtr lpcClass = (IntPtr)11;
    System.Runtime.InteropServices.ComTypes.FILETIME lpftLastWriteTime;
    uint ret3 = OREnumKey(myKey, dwindex, out lpName, ref lpcName, out lpClass, ref lpcClass, out lpftLastWriteTime);

ret3=ERROR_MORE_DATA 234
Problem can be in wrong StringBuilder Size, or FILETIME
2nd How i should call PWSTR param from C#?
[MarshalAs(UnmanagedType.LPWStr)]out StringBuilder lpName is it correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:03:58+00:00Added an answer on June 4, 2026 at 11:03 pm

    This is a pretty standard Windows error code, it means that you called a winapi function and you didn’t pass a big enough buffer. The only way to fix the problem is to pass a bigger buffer.

    This looks a lot like a wrapper for RegQueryKeyEx(), which makes it very likely that you are passing bad data to the function. The lpcName argument is actually ref int, not IntPtr. And you are supposed to pass a variable that stores the size of the buffer you passed, 255 in your case. The lpcClass argument is similarly borked. This ought to fix it:

    [DllImport("offreg.dll", CharSet = CharSet.Unicode, SetLastError = true)]
    public static extern uint OREnumKey(
        IntPtr Handle, 
        int dwIndex,
        StringBuilder lpName, 
        ref int lpcName, 
        StringBuilder lpClass, 
        ref int lpcClass, 
        out System.Runtime.InteropServices.ComTypes.FILETIME lpftLastWriteTime);
    
        ...   
        StringBuilder lpName=new StringBuilder("",255);
        int nameSize = lpName.Capacity;
        StringBuilder  lpClass=new StringBuilder("",255);
        int classSize = lpClass.Capacity;
        System.Runtime.InteropServices.ComTypes.FILETIME lpftLastWriteTime;
        uint ret3 = OREnumKey(hiveid, 0, lpName, ref nameSize, lpClass, ref classSize, out lpftLastWriteTime);
        if (ret3 != 0) throw new Exception("kaboom");
        string name = lpName.ToString();
        string className = lpClass.ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a native api function which looks like: DWORD WINAPI WlanRegisterNotification( __in HANDLE
I'm trying to convert this function to JNA: DWORD WINAPI WlanHostedNetworkSetProperty( __in HANDLE hClientHandle,
For: DWORD GetAdaptersInfo( __out PIP_ADAPTER_INFO pAdapterInfo, __inout PULONG pOutBufLen ); The description of pOutBufLen
HANDLE hThread; DWORD dwThreadId; hThread = CreateThread( NULL, // default security attributes 0, //
I am trying to use the following functions defined in mpusbapi.h HANDLE(*MPUSBOpen)(DWORD instance, //Input
I am playing with lambda in Visual C++ 11. void CWin32Service::RunService (__in DWORD dwArgc,
Having : var Difference: DWORD // difference shows in milliseconds // List.Items.Count can be
I have the DWORD socket in windows. I need to know if it is
This typedef: typedef DWORD WINAPI (* CM_Open_DevNode_Key)(DWORD, DWORD, DWORD, DWORD, PHKEY, DWORD); compiles fine
I'm currently using C Builder: DWORD finalAddress = 0xFFFFFFFF; TListItem *ListIt; ListIt->Caption = finalAddress;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.