Skip to content

Commit

Permalink
xp simple delete
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory Mullen (grayhatter) committed May 18, 2015
1 parent 04ea6f1 commit f49b584
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions windows/main.XP.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ void launch_at_startup(int is_launch_at_startup){
path[path_length+1] = '\"';
path[path_length+2] = '\0';
path_length += 2;
ret = RegSetValueExW(hKey, L"uTox", NULL, REG_SZ, path, path_length*2); /*2 bytes per wchar */
ret = RegSetValueExW(hKey, L"uTox", NULL, REG_SZ, (uint8_t*)path, path_length*2); /*2 bytes per wchar */
if(ret == ERROR_SUCCESS){
debug("Successful auto start addition.\n");
}
RegCloseKey(hKey);
}
}
if(is_launch_at_startup == 0){
debug("Going to delete auto start key.\n");
if(ERROR_SUCCESS == RegOpenKeyW(HKEY_CURRENT_USER, run_key_path, &hKey)){
ret = RegDeleteKeyValueExW(hKey, L"uTox", NULL);
debug("Successful key opened.\n");
ret = RegDeleteValueW(hKey, L"uTox");
if(ret == ERROR_SUCCESS){
debug("Successful auto start deletion.\n");
} else {
debug("UN-Successful auto start deletion.\n");
}
RegCloseKey(hKey);
}
Expand Down

0 comments on commit f49b584

Please sign in to comment.