I really need to work out how to do this, i need to basically load a .rar file into the memory so i can decompress it, currently i am loading the rar file from a resource into the memory then decompressing it, but i need to load it from a file rather than resource.
Heres how im loading it from resource:
void openRARResource(MemoryFile *memfile, int resource_id)
HINSTANCE hInstance = GetModuleHandleA(NULL);
memfile->data = 0;
memfile->size = 0;
memfile->offset = 0;
hsResourceFH = FindResource(hInstance, MAKEINTRESOURCE(resource_id), "RARFILE");
hgResourceLH = LoadResource(hInstance, hsResourceFH);
memfile->size = SizeofResource(hInstance, hsResourceFH);
memfile->data = (void*)LockResource(hgResourceLH);
This is how its called:
This is how MemoryFile Is defined:
You can see there that i need the file data, file size, and memory offset...
typedef struct memory_file
void *data; /* pointer to the file data */
unsigned long size; /* total size of the file data */
unsigned long offset; /* offset within "memory-file" */
I would like if possible to load the file into the MemoryFile varible, but as i said from a .rar on the hdd rather than from the programs resources.
I would majorly appreciate any help,