mirror of https://github.com/infosecn1nja/C3.git
Update resource generation and access to match C style
parent
8f908f020c
commit
6aec395e30
|
@ -4,7 +4,7 @@
|
|||
#error Unknown resource guid.
|
||||
#endif // !EMBEDDED_DLL_PAYLOAD
|
||||
|
||||
// Payload form [16 byte guid][1 byte terminator 0xff][4 byte size][body]
|
||||
// Payload form [16 byte guid][1 byte terminator 0xff][4 byte size][body][4 byte size][ExportName (null terminated)]
|
||||
|
||||
static char* FindStartOfResource(void* startofImage)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ inline size_t GetExportNameSize(void* startOfResource)
|
|||
return *(int32_t*)(GetPayloadEnd(startOfResource));
|
||||
}
|
||||
|
||||
inline std::string_view GetExportName(void* startOfResource)
|
||||
inline const char* GetExportName(void* startOfResource)
|
||||
{
|
||||
return {(char*)GetPayloadEnd(startOfResource) + 4, GetExportNameSize(startOfResource) };
|
||||
return (char*)GetPayloadEnd(startOfResource) + 4;
|
||||
}
|
|
@ -28,7 +28,6 @@ namespace ResourceGenerator
|
|||
sw.Write("\"\n");
|
||||
}
|
||||
|
||||
|
||||
using (var bw = new BinaryWriter(File.Open(Path.Join(outputDir, "EmbeddedResource.dat"), FileMode.Create)))
|
||||
{
|
||||
var data = File.ReadAllBytes(args[0]);
|
||||
|
@ -37,8 +36,9 @@ namespace ResourceGenerator
|
|||
bw.Write(BitConverter.GetBytes(data.Length));
|
||||
bw.Write(data);
|
||||
string exportName = args.Length < 3 ? "" : args[2];
|
||||
bw.Write(BitConverter.GetBytes(exportName.Length));
|
||||
bw.Write(BitConverter.GetBytes(exportName.Length + 1)); // + 1 for null termination
|
||||
bw.Write(Encoding.ASCII.GetBytes(exportName));
|
||||
bw.Write((byte)0x00);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue