title: How to compare in C code LONG data from registry?
body: <p>I think it's easy question who knows C, (i'm not)</p>
  
  <p>I have code that checks if Proxy is enabled. </p>
  
  <p>From Registry:</p>
  
  <p><img src="https://i.stack.imgur.com/vVWRu.png" alt="enter image description here"> </p>
  
  <p>From <code>cmd</code>:</p>
  
  <blockquote>
    <p>C:\Users\Max>reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\Cur
    rentVersion\Internet Settings" | find /i "proxyenable"
        ProxyEnable    REG_DWORD    0x1 </p>
  </blockquote>
  
  <p>Here is relevant snippets of code:</p>
  
  <pre><code>#define POLICY_KEY TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")
  
    ...
  
      HKEY hKey;
  LONG lResult;
  LONG lResultServer;
  DWORD dwValue, dwType, dwSize = sizeof(dwValue);
  
  DWORD szType = REG_SZ;
  char rgValue [1024];
  DWORD BufSize = sizeof(rgValue);
  
  const char *defaultVal = "0";
  
  
  lResult = RegOpenKeyEx(HKEY_CURRENT_USER, POLICY_KEY, 0, KEY_READ, &amp;hKey);
  
  if(lResult == ERROR_SUCCESS)
  {
      lResult = RegQueryValueEx(hKey, "ProxyEnable", 0, &amp;dwType, (LPBYTE)&amp;dwValue, &amp;dwSize);
      RegCloseKey(hKey);
  }
  
  // Exit if a policy value was found.
  if(lResult == ERROR_SUCCESS)
  {   
  
      if((int)lResult == 1) //  &lt;- problematic place
      {
  
            ...
  
       ...        
  </code></pre>
  
  <p>I don't know why, but <code>if((int)lResult == 1)</code> returns false.</p>
  
  <p>What I need to do to comapare that <code>lResult  = 0x00000001</code>.</p>
  
  <p>Thank you, </p>