title: I do not see registry key even though GetLastError returns all 0
body: <p>I try to make file dropper and launch at startup but then it DOES start up correctly but when i navigate to said key using regedit i cannot see it? What is up with that? All error codes return 0.....</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;windows.h&gt;
  #include &lt;Shlwapi.h&gt;
  using namespace std;
  string RegistryKeyName = "testdropper.exe";
  
  int main()
  {
      std::string filename ="\\";
      char system[MAX_PATH];
      char pathtofile[MAX_PATH];
      memset(system, 0, MAX_PATH);
      memset(pathtofile, 0, MAX_PATH);
  
  
      //GET MODULE HANDLE OF CALLING PROGRAM I.E SERVER.EXE'S HANDLE
      HMODULE GetModH = GetModuleHandle(NULL);
  
  cout &lt;&lt; GetLastError();
      //GET PATH OF exe
      GetModuleFileName(GetModH,pathtofile,sizeof(pathtofile));
  
      filename.append(PathFindFileNameA(pathtofile));
  
      //GET SYSTEM DIRECTORY LIKE SYSTEM32
      GetSystemDirectory(system,sizeof(system));
  
      //APPEND MY FILENAME AFTER THE SYSTEMDIRECTORY 
      strcat(system, filename.c_str());
  
      //COPY SERVER TO THE SYSTEM32 FOLDER
      CopyFile(pathtofile,system,false);
  
      //MAKE A REGISTRY KEY TO THE SYSTEM32FOLDER WITH SERVER.EXE TO RUN AT STARTUP
      HKEY hKey;
  
      RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_SET_VALUE,&amp;hKey );
  
      RegSetValueEx(hKey, RegistryKeyName.c_str(),0,REG_SZ,(const BYTE*)system,sizeof(system));
  
      RegCloseKey(hKey);
  
  
       return 0;
  }
  </code></pre>