1 static char *get_resource(char *id, unsigned *size) 2 { 3 HRSRC hr = FindResource(GetModuleHandle(NULL), id, RT_RCDATA); 4 5 if (hr == NULL) return NULL; 6 *size = SizeofResource(GetModuleHandle(NULL), hr); 7 h = LoadResource(GetModuleHandle(NULL), hr); 8 return (char *)LockResource(h); 9 } 10 11 static void free_resource(void) 12 { 13 if (h) 14 { 15 FreeResource(h); 16 h = 0; 17 } 18 }