Click here to Skip to main content
15,886,833 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi everyone
using C++ code i want to check whether RebootRequired folder is present or not in regedit. how can i do?
the registry path in which i have to search for rebootRequired folder is:
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
Posted

Of course you can, using the Registry API[^]. However your application needs proper privileges in order to access HKEY_LOCAL_MACHINE subtrees.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 3-Aug-15 11:25am    
5ed.
—SA
CPallini 3-Aug-15 12:16pm    
Thank you.
hey guys finally i got solution.
XML
#include "stdafx.h"

//#include <winreg.h>
#include<windows.h>
#include<string>

bool function();

int _tmain(int argc, _TCHAR* argv[])
{
    if (function())
    {
        printf("hi");
    }

}

bool function()
{
    HKEY hKey;
    LPCTSTR subKey;
    LPCTSTR subValue;
    HKEY resKey;
    DWORD dataLen;
    hKey = HKEY_LOCAL_MACHINE;
    subKey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired";

    long key = RegOpenKeyExA(hKey, subKey, 0, KEY_READ | KEY_WRITE, &resKey);
    if (key == ERROR_SUCCESS)
        {
        printf("sucess");

    }
    else
    {
        printf("registry not present");
        return false;
    }
}</string></windows.h></winreg.h>
 
Share this answer
 
v2
Comments
KarstenK 4-Aug-15 6:43am    
Consider only using the KEY_READ flag, so you havent any trouble with access rights.
Member 11460314 4-Aug-15 7:15am    
like you said i did the same. now i can access till "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update

but cannot access RebootRequired still

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900