Home | Info | Community | Development | myReactOS | Contact Us
[static]
Definition at line 55 of file reg.c.
Referenced by RegInstallW().
{ HRSRC hrsrc; HGLOBAL hmem = NULL; DWORD rsrc_size, bytes_written; VOID *rsrc_data; HANDLE hf = INVALID_HANDLE_VALUE; if(!get_temp_ini_path(ini_file)) { ERR("Can't get temp ini file path\n"); goto error; } if(!(hrsrc = FindResourceW(hm, REGINST, REGINST))) { ERR("Can't find REGINST resource\n"); goto error; } rsrc_size = SizeofResource(hm, hrsrc); hmem = LoadResource(hm, hrsrc); rsrc_data = LockResource(hmem); if(!rsrc_data || !rsrc_size) { ERR("Can't load REGINST resource\n"); goto error; } if((hf = CreateFileW(ini_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) { ERR("Unable to create temp ini file\n"); goto error; } if(!WriteFile(hf, rsrc_data, rsrc_size, &bytes_written, NULL) || rsrc_size != bytes_written) { ERR("Write failed\n"); goto error; } FreeResource(hmem); CloseHandle(hf); return TRUE; error: if(hmem) FreeResource(hmem); if(hf != INVALID_HANDLE_VALUE) CloseHandle(hf); return FALSE; }