Thread: Help! Access violation error in C++

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    2

    Exclamation Help! Access violation error in C++

    Hi everyone! I'm trying to enumerate registry keys:
    Code:
    LONG i;
    HKEY root; 
    DWORD retCode; 
    DWORD dwIndex=0;
    CHAR achKey[MAX_PATH];
    const TCHAR szRegRoot[] = _T("Software\\Microsoft\\Office"); 
    
    retCode=RegOpenKeyEx(HKEY_CURRENT_USER, szRegRoot, 0, KEY_READ, &root); 
    
    for (i = 0, retCode = ERROR_SUCCESS; retCode == ERROR_SUCCESS; i++) 
    {    retCode = RegEnumKeyEx(root, 
                         i, 
                         achKey, 
                         (ULONG *)MAX_PATH, 
                         NULL, 
                         NULL, 
                         NULL, 
                         NULL); 
    }
    When I about to execute RegEnumKeyEx(...) I got the error:
    First-chance exception in p5.exe (ADVAPI32.DLL): 0xC0000005: Access Violation.
    Enviroment: Win2K, VC++6.0.
    Thanks!
    Last edited by runlevel007; 03-18-2003 at 07:44 PM.

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    2
    Thanks everybody, I got the answer.

  3. #3
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    You're welcome!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Access violation... can't figure it out...
    By Raigne in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2007, 10:52 AM
  2. access violation in int array
    By George2 in forum C Programming
    Replies: 2
    Last Post: 08-02-2007, 11:28 PM
  3. FtpFileFind access violation with MS VC++ 6.0
    By earth_angel in forum C++ Programming
    Replies: 3
    Last Post: 09-22-2005, 07:02 PM
  4. Help! CListCtrl access violation
    By bonkey in forum Windows Programming
    Replies: 4
    Last Post: 11-18-2003, 02:40 PM
  5. 0xC0000005: Access Violation
    By Strider in forum Windows Programming
    Replies: 3
    Last Post: 11-07-2001, 02:46 PM