UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
syms_pe_parser.c
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#ifndef SYMS_PE_PARSER_C
4#define SYMS_PE_PARSER_C
5
7//~ allen: Functions
8
11 // based range setup
12 void *base = data.str;
13 SYMS_U64Range range = {0, data.size};
14
15 // read dos header
18
19 // fill result
21 if (dos_header.magic == SYMS_DOS_MAGIC){
22 result = syms_push_array(arena, SYMS_PeFileAccel, 1);
23 result->format = SYMS_FileFormat_PE;
24 result->coff_off = dos_header.coff_file_offset;
25 }
26
27 return(result);
28}
29
32 // based range setup
33 void *base = data.str;
34 SYMS_U64Range range = {0, data.size};
35
36 // read pe magic
37 SYMS_U32 coff_off = accel->coff_off;
39 syms_based_range_read_struct(base, range, coff_off, &pe_magic);
40
41 // check pe magic
43 if (pe_magic == SYMS_PE_MAGIC){
44
45 // read coff header
46 SYMS_U32 coff_header_off = coff_off + sizeof(pe_magic);
49
50 // range of optional extension header ("optional" for short)
51 SYMS_U32 optional_size = coff_header.size_of_optional_header;
57
58 // get sections
64
65 // get symbols
66 SYMS_U64 symbol_array_off = coff_header.pointer_to_symbol_table;
67 SYMS_U64 symbol_count = coff_header.number_of_symbols;
68
69 // get string table
70 SYMS_U64 string_table_off = symbol_array_off + sizeof(SYMS_CoffSymbol16) * symbol_count;
71
72 // read ptional header
74 SYMS_U64 image_base = 0;
75 SYMS_U64 entry_point = 0;
76 SYMS_U32 data_dir_count = 0;
77 SYMS_U64 virt_section_align = 0;
78 SYMS_U64 file_section_align = 0;
79 SYMS_U64Range *data_dir_franges = 0;
80 if (optional_size > 0){
81 // read magic number
83
84 // read optional
87 switch (optional_magic){
88 case SYMS_PE32_MAGIC:
89 {
92
93 image_base = pe_optional.image_base;
94 entry_point = pe_optional.entry_point_va;
95 virt_section_align = pe_optional.section_alignment;
96 file_section_align = pe_optional.file_alignment;
97
99 reported_data_dir_count = pe_optional.data_dir_count;
100 }break;
102 {
105
106 image_base = pe_optional.image_base;
107 entry_point = pe_optional.entry_point_va;
108 virt_section_align = pe_optional.section_alignment;
109 file_section_align = pe_optional.file_alignment;
110
112 reported_data_dir_count = pe_optional.data_dir_count;
113 }break;
114 }
115
118 // convert PE directories to ranges
119 data_dir_franges = syms_push_array(arena, SYMS_U64Range, data_dir_count);
120 for (SYMS_U32 dir_idx = 0; dir_idx < data_dir_count; dir_idx += 1){
125 data_dir_franges[dir_idx] = syms_make_u64_inrange(range, file_off, dir.virt_size);
126 }
127 }
128
129 // read info about debug file
130 SYMS_U32 dbg_time = 0;
131 SYMS_U32 dbg_age = 0;
132 SYMS_PeGuid dbg_guid = {0};
133 SYMS_U64 dbg_path_off = 0;
134 SYMS_U64 dbg_path_size = 0;
135
136 if (SYMS_PeDataDirectoryIndex_DEBUG < data_dir_count){
137 // read debug directory
138 SYMS_PeDebugDirectory dbg_data = {0};
139 syms_based_range_read_struct(base, data_dir_franges[SYMS_PeDataDirectoryIndex_DEBUG], 0, &dbg_data);
140 // extract external file info from codeview header
142 SYMS_U64 cv_offset = dbg_data.file_offset;
143 SYMS_U32 cv_magic = 0;
145 switch (cv_magic){
146 default:break;
148 {
151 // TODO(allen): can we extend the ext match key system to use this in some way?
152 dbg_time = cv.time;
153 dbg_age = cv.age;
154 dbg_path_off = cv_offset + sizeof(cv);
155 }break;
157 {
160 dbg_guid = cv.guid;
161 dbg_age = cv.age;
162 dbg_path_off = cv_offset + sizeof(cv);
163 }break;
164 }
165 if (dbg_path_off > 0){
166 SYMS_String8 dbg_path = syms_based_range_read_string(base, range, dbg_path_off);
167 dbg_path_size = dbg_path.size;
168 }
169 }
170 }
171
172 // fill result
173 result = syms_push_array(arena, SYMS_PeBinAccel, 1);
174 result->format = SYMS_FileFormat_PE;
175 result->image_base = image_base;
176 result->entry_point = entry_point;
178 result->virt_section_align = virt_section_align;
179 result->file_section_align = file_section_align;
182 result->symbol_array_off = symbol_array_off;
183 result->symbol_count = symbol_count;
184 result->string_table_off = string_table_off;
185 result->dbg_path_off = dbg_path_off;
186 result->dbg_path_size = dbg_path_size;
187 result->dbg_guid = dbg_guid;
188 result->dbg_age = dbg_age;
189 result->dbg_time = dbg_time;
191 // store file ranges for data directories
192 result->data_dir_franges = data_dir_franges;
193 result->data_dir_count = data_dir_count;
194 }
195
196 return(result);
197}
198
201 SYMS_Arch result = bin->arch;
202 return(result);
203}
204
207 SYMS_ExtFileList result = {0};
208 if (bin->dbg_path_size > 0 && bin->dbg_path_off + bin->dbg_path_size <= data.size){
209 SYMS_String8 name = {0};
210 name.str = data.str + bin->dbg_path_off;
211 name.size = bin->dbg_path_size;
213 SYMS_QueuePush(result.first, result.last, node);
214 result.node_count += 1;
215 node->ext_file.file_name = name;
216 syms_memmove(&node->ext_file.match_key, &bin->dbg_guid, sizeof(bin->dbg_guid));
217 }
218 return(result);
219}
220
226
229 SYMS_U64 result = bin->entry_point;
230 return(result);
231}
232
236
237 //- allen: get import sources
241
242 //- allen: compute total # of imports
244 for (SYMS_U64 i = 0; i < SYMS_ARRAY_SIZE(imp_sources); i += 1){
245 SYMS_PeImportDllArray *imports = &imp_sources[i];
246 SYMS_PeImportDll *opl = imports->import_dlls + imports->count;
247 for (SYMS_PeImportDll *n = imports->import_dlls; n < opl; n += 1){
248 total_import_count += n->name_table.count;
249 }
250 }
251
252 //- allen: allocate output array
253 SYMS_ImportArray result = {0};
255 result.count = total_import_count;
256
257 //- allen: fill output array
258 SYMS_Import *imp = result.imports;
259
260 // for each source...
261 for (SYMS_U64 i = 0; i < SYMS_ARRAY_SIZE(imp_sources); i += 1){
262
263 // for each dll...
264 SYMS_PeImportDllArray *imports = &imp_sources[i];
265 SYMS_PeImportDll *opl = imports->import_dlls + imports->count;
266 for (SYMS_PeImportDll *n = imports->import_dlls; n < opl; n += 1){
267
268 // for each import name...
269 SYMS_U64 import_count = n->name_table.count;
270 SYMS_PeImportName *name_ptr = n->name_table.names;
271 SYMS_String8 library_name = syms_push_string_copy(arena, n->name);
272 for (SYMS_U64 j = 0; j < import_count; j += 1, name_ptr += 1){
273
274 // fill imp & advance
275 imp->library_name = library_name;
276 if (name_ptr->lookup == SYMS_PeImportLookup_NameHint){
277 imp->name = name_ptr->name;
278 }
279 else{
280 imp->ordinal = name_ptr->ordinal;
281 }
282 imp += 1;
283 }
284 }
285 }
286
287 //- allen: finish
289 return(result);
290}
291
294 // TODO(allen): accelerate voff -> foff
295
297
300 void *base = (void*)data.str;
301
302 SYMS_PeExportTable *header = (SYMS_PeExportTable*)(data.str + dir_range.min);
303
304 // export table
306 {
308 export_table.u32 = (SYMS_U32*)(data.str + foff);
310 }
311
312 // name pointer table
313 SYMS_U32Array name_table = {0};
314 {
316 name_table.u32 = (SYMS_U32*)(data.str + foff);
317 name_table.count = header->name_pointer_table_count;
318 }
319
320 // ordinal table
322 {
324 ordinal_table.u16 = (SYMS_U16*)(data.str + foff);
326 }
327
328 // Scan export address table to get accruate count of ordinals.
329 // We can't rely on "name_pointer_table_count" becuase it is possible
330 // to define an export without a name through NONAME attribute in DEF file
332 for (SYMS_U64 voff_idx = 0; voff_idx < export_table.count; voff_idx += 1){
333 if (export_table.u32[voff_idx] != 0){
334 ordinal_count += 1;
335 }
336 }
337
338 // ordinal base
339 SYMS_U32 ordinal_base = header->ordinal_base;
340
341 //
344
345 // allocate output array
346 SYMS_ExportArray result = {0};
348 result.count = ordinal_count;
349
350 // fill output array with named exports
351 SYMS_Export *exp = result.exports;
352 SYMS_Export *exp_opl = result.exports + result.count;
353 SYMS_U32 *name_ptr = name_table.u32;
354 SYMS_U32 *name_opl = name_table.u32 + name_table.count;
356 for (; name_ptr < name_opl;
357 name_ptr += 1, ordinal_ptr += 1, exp += 1){
358 // get name
359 SYMS_String8 name = {0};
360 {
361 SYMS_U32 foff = syms_pe_bin_foff_from_voff(data, bin, *name_ptr);
363 name = syms_push_string_copy(arena, raw_name);
364 }
365
366 // get ordinal
368
369 // mark ordinal
371
372 // get voff
374 if (ordinal_nobase < export_table.count){
376 }
377
378 // make ordinal
379 SYMS_U16 ordinal = ordinal_nobase + ordinal_base;
380
381 // fill out export
382 exp->name = name;
383 exp->address = export_voff;
384 exp->ordinal = ordinal;
385 }
386
387 // fill output array with noname exports
390 SYMS_B32 is_voff_taken = (voff != 0);
393 if (exp < exp_opl){
394 exp->name = syms_str8(0,0);
395 exp->address = voff;
396 exp->ordinal = ordinal_nobase + ordinal_base;
397 exp += 1;
398 }
399 }
400 }
401
402 // resolve forward ferences
403 for (exp = result.exports; exp < exp_opl; exp += 1){
404 // determine if this is a forwarder
405 SYMS_U32 export_foff = syms_pe_bin_foff_from_voff(data, bin, exp->address);
406 SYMS_B32 is_forwarder = (dir_range.min <= export_foff && exp->address < dir_range.max);
407
408 if (is_forwarder){
409 // parse forwarder command string that is formatted like "<DLL>.<IMPORT>" (e.g. NTDLL.RtlZeroMemory)
410 SYMS_String8 library_name = syms_str8_lit("<error-dll>");
411 SYMS_String8 import_name = syms_str8_lit("<error-import>");
412 {
416 if (list.node_count == 2){
417 library_name = list.first->string;
418 import_name = list.last->string;
419 }
421 }
422
423 // fill forwarder
424 exp->address = 0;
425 exp->forwarder_library_name = syms_push_string_copy(arena, library_name);
426 exp->forwarder_import_name = syms_push_string_copy(arena, import_name);
427 }
428 }
429
431 return(result);
432}
433
435//~ allen: PE Specific Helpers
436
437// pdata
438
441 // TODO(allen): cleanup pass.
442
443 SYMS_ASSERT(bin->arch == SYMS_Arch_X86 || bin->arch == SYMS_Arch_X64);
445 SYMS_U64 pdata_off = range.min;
446 SYMS_U64 pdata_count = (range.max - range.min)/sizeof(SYMS_PeIntelPdata);
447
448 SYMS_U64 result = 0;
449 // check if this bin includes a pdata array
450 if (pdata_count > 0){
452 if (voff >= pdata_array[0].voff_first){
453
454 // binary search:
455 // find max index s.t. pdata_array[index].voff_first <= voff
456 // we assume (i < j) -> (pdata_array[i].voff_first < pdata_array[j].voff_first)
457 SYMS_U64 index = pdata_count;
458 SYMS_U64 min = 0;
459 SYMS_U64 opl = pdata_count;
460 for (;;){
461 SYMS_U64 mid = (min + opl)/2;
463 if (voff < pdata->voff_first){
464 opl = mid;
465 }
466 else if (pdata->voff_first < voff){
467 min = mid;
468 }
469 else{
470 index = mid;
471 break;
472 }
473 if (min + 1 >= opl){
474 index = min;
475 break;
476 }
477 }
478
479 // if we are in range fill result
480 {
482 if (pdata->voff_first <= voff && voff < pdata->voff_one_past_last){
483 result = pdata_off + index*sizeof(SYMS_PeIntelPdata);
484 }
485 }
486 }
487 }
488
489 return(result);
490}
491
492// sections
493
496 SYMS_U64 sec_count = bin->section_count;
499 SYMS_U64 result = 0;
500 for (SYMS_U64 i = 1; i <= sec_count; i += 1, sec_ptr += 1){
501 if (sec_ptr->virt_off <= voff && voff < sec_ptr->virt_off + sec_ptr->virt_size){
502 result = i;
503 break;
504 }
505 }
506 return(result);
507}
508
509SYMS_API void*
511 void *result = 0;
512 SYMS_U64 sec_count = bin->section_count;
513 if (1 <= n && n <= sec_count){
515 SYMS_CoffSectionHeader *sec = sec_array + n - 1;
516 if (sec->file_size > 0){
517 result = data.str + sec->file_off;
518 }
519 }
520 return(result);
521}
522
523SYMS_API void*
525 void *result = 0;
526 if (foff < data.size){
527 result = data.str + foff;
528 }
529 return(result);
530}
531
532SYMS_API void*
534 //- get the section for this voff
535 SYMS_U64 sec_count = bin->section_count;
538 SYMS_CoffSectionHeader *sec = 0;
539 for (SYMS_U64 i = 1; i <= sec_count; i += 1, sec_ptr += 1){
540 if (sec_ptr->virt_off <= voff && voff < sec_ptr->virt_off + sec_ptr->virt_size){
541 sec = sec_ptr;
542 break;
543 }
544 }
545
546 //- adjust to file pointer
547 void *result = 0;
548 if (sec != 0 & sec_ptr->file_size > 0){
549 result = data.str + voff - sec->virt_off + sec->file_off;
550 }
551
552 return(result);
553}
554
557 SYMS_U64 file_off = 0;
558 for (SYMS_U32 sect_idx = 0; sect_idx < section_count; sect_idx += 1){
560 if (sect->virt_off <= virt_off && virt_off < sect->virt_off + sect->virt_size){
562 file_off = sect->file_off + (virt_off - sect->virt_off);
563 }
564 break;
565 }
566 }
567 return file_off;
568}
569
574
575// imports & exports
576
579 // scan for terminator
580 SYMS_U64 *ptr = src;
581 for (; *ptr != 0 && ptr < opl; ptr += 1);
582
583 // make copy of the array
584 SYMS_U64Array result = {0};
585 result.count = (SYMS_U64)(ptr - src);
586 result.u64 = syms_push_array(arena, SYMS_U64, result.count);
587 syms_memmove(result.u64, src, result.count*sizeof(SYMS_U64));
588 return(result);
589}
590
593 // scan for terminator
594 SYMS_U32 *ptr = src;
595 for (; *ptr != 0 && ptr < opl; ptr += 1);
596
597 // make copy of the array (and transform U32 -> U64)
598 SYMS_U64Array result = {0};
599 result.count = (SYMS_U64)(ptr - src);
600 result.u64 = syms_push_array(arena, SYMS_U64, result.count);
601 SYMS_U64 *o = result.u64;
602 SYMS_U32 *i = src;
603 for (; i < ptr; o += 1, i += 1){
604 *o = *i;
605 }
606 return(result);
607}
608
612 SYMS_U64Array result = {0};
613 if (bin->is_pe32){
614 SYMS_U32* src = (SYMS_U32*)(data.str + foff);
615 SYMS_U32* opl = (SYMS_U32*)(data.str + SYMS_AlignDownPow2(data.size, 4));
616 result = syms_u64_array_from_null_term_u32_string(arena, src, opl);
617 }
618 else {
619 SYMS_U64* src = (SYMS_U64*)(data.str + foff);
620 SYMS_U64* opl = (SYMS_U64*)(data.str + SYMS_AlignDownPow2(data.size, 8));
621 result = syms_u64_array_from_null_term_u64_string(arena, src, opl);
622 }
623 return(result);
624}
625
629 SYMS_PeImportName result = {0};
630
631 //- determine case
633 if (bin->is_pe32){
634 is_ordinal = !!(name_entry & (1 << 31));
635 }
636 else{
637 is_ordinal = !!(name_entry & ((SYMS_U64)1 << 63));
638 }
639
640 //- ordinal case
641 if (is_ordinal){
643 result.ordinal = (name_entry & SYMS_U16_MAX);
644 }
645
646 //- voff case
647 else{
648 // TODO(allen): accelerate voff -> foff
650
651 // setup read helper
652 void *base = (void*)data.str;
653 SYMS_U64Range range = syms_make_u64_range(0, data.size);
654
655 // read hint & string
656 SYMS_U16 hint = 0;
657 syms_based_range_read_struct(base, range, foff, &hint);
658 SYMS_String8 name = syms_based_range_read_string(base, range, foff + sizeof(SYMS_U16));
659
660 // fill result
662 result.name = syms_push_string_copy(arena, name);
663 result.ordinal = hint;
664 }
665
666 return(result);
667}
668
672 //- allocate output array
673 SYMS_PeImportNameArray result = {0};
675 result.count = name_entries.count;
676
677 //- setup read helper
678 void *base = (void*)data.str;
679 SYMS_U64Range range = syms_make_u64_range(0, data.size);
680
681 //- determine ordinal mask
682 SYMS_U64 ordinal_mask = ((SYMS_U64)1 << 63);
683 if (bin->is_pe32){
684 ordinal_mask = (1 << 31);
685 }
686
687 //- fill output
688 SYMS_PeImportName *name_ptr = result.names;
690 for (SYMS_U64 i = 0;
691 i < name_entries.count;
692 i += 1, name_ptr += 1, name_entry_ptr += 1){
695
696 if (is_ordinal){
698 name_ptr->ordinal = (name_entry & SYMS_U16_MAX);
699 }
700 else{
701 // TODO(allen): accelerate voff -> foff
703
704 // read hint & string
705 SYMS_U16 hint = 0;
706 syms_based_range_read_struct(base, range, foff, &hint);
707 SYMS_String8 name = syms_based_range_read_string(base, range, foff + sizeof(SYMS_U16));
708
709 // fill result
711 name_ptr->name = syms_push_string_copy(arena, name);
712 name_ptr->ordinal = hint;
713 }
714 }
715
716 return(result);
717}
718
721 //- grab ranges
722 void *base = (void *)data.str;
725
726 //- get import entries array
728
729 //- count imports
732 {
735 for (; ptr < opl; ptr += 1){
736 if (syms_memisnull_struct(ptr)){
737 break;
738 }
739 }
741 }
742
743 //- allocate output array
744 SYMS_PeImportDllArray result = {0};
746 result.count = import_count;
747
748 //- fill output
752 for (; import_entry < opl; import_entry += 1, dll += 1){
753 // TODO(allen): accelerate voff -> foff
754
755 // get name
756 SYMS_String8 name = {0};
757 {
758 SYMS_U64 foff = syms_pe_bin_foff_from_voff(data, bin, import_entry->name_voff);
760 name = syms_push_string_copy(arena, name_raw);
761 }
762
763 // get name table
764 SYMS_PeImportNameArray name_table = {0};
765 {
766 SYMS_U64 foff = syms_pe_bin_foff_from_voff(data, bin, import_entry->lookup_table_voff);
768 name_table = syms_pe_import_name_array_from_name_entries(arena, data, bin, entries);
769 }
770
771 // fill dll slot
772 dll->name = name;
773 dll->name_table = name_table;
774 }
775
776 return(result);
777}
778
782
783 //- grab prerequisites
784 void *base = (void *)data.str;
787
788 //- get import entries array
790
791 //- count imports
794 {
797 for (; ptr < opl; ptr += 1){
798 if (syms_memisnull_struct(ptr)){
799 break;
800 }
801 }
803 }
804
805 //- allocate output array
806 SYMS_PeImportDllArray result = {0};
808 result.count = import_count;
809
810 //- parse directory
814 for (SYMS_U64 i = 0; i < import_count; i += 1, import_ptr += 1, dll += 1){
815 // TODO(allen): accelerate voff -> foff
816
817 //- get name
818 SYMS_String8 name = {0};
819 {
820 SYMS_U64 foff = syms_pe_bin_foff_from_voff(data, bin, import_ptr->name_voff);
822 name = syms_push_string_copy(arena, raw_name);
823 }
824
825 //- get name table
826 SYMS_PeImportNameArray name_table = {0};
827 {
828 SYMS_U64 foff = syms_pe_bin_foff_from_voff(data, bin, import_ptr->name_table_voff);
830 name_table = syms_pe_import_name_array_from_name_entries(arena, data, bin, entries);
831 }
832
833 //- bound imports
834 SYMS_U64Array bound_table = {0};
835 {
836 SYMS_U64 foff = syms_pe_bin_foff_from_voff(data, bin, import_ptr->bound_table_voff);
837 bound_table = syms_pe_u64_array_from_null_term_addr_string(arena, data, bin, foff);
838 }
839
840 //- build node
841 dll->name = name;
842 dll->name_table = name_table;
843 dll->bound_table = bound_table;
844 }
845
847
848 return(result);
849}
850
863
864#endif //SYMS_PE_PARSER_C
865
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition syms_base.h:402
Definition syms_meta_coff.h:55
Definition syms_meta_coff.h:110
SYMS_U32 virt_off
Definition syms_meta_coff.h:113
SYMS_U32 file_size
Definition syms_meta_coff.h:114
SYMS_U32 file_off
Definition syms_meta_coff.h:115
Definition syms_coff.h:54
Definition syms_meta_pe.h:7
Definition syms_debug_info.h:69
SYMS_Export * exports
Definition syms_debug_info.h:70
SYMS_U64 count
Definition syms_debug_info.h:71
Definition syms_debug_info.h:45
Definition syms_debug_info.h:119
SYMS_ExtFileNode * first
Definition syms_debug_info.h:120
SYMS_U64 node_count
Definition syms_debug_info.h:122
SYMS_ExtFileNode * last
Definition syms_debug_info.h:121
Definition syms_debug_info.h:114
SYMS_ExtFile ext_file
Definition syms_debug_info.h:116
SYMS_String8 file_name
Definition syms_debug_info.h:110
SYMS_ExtMatchKey match_key
Definition syms_debug_info.h:111
Definition syms_debug_info.h:64
SYMS_Import * imports
Definition syms_debug_info.h:65
SYMS_U64 count
Definition syms_debug_info.h:66
Definition syms_debug_info.h:39
Definition syms_pe_parser.h:15
SYMS_U64 image_base
Definition syms_pe_parser.h:17
SYMS_FileFormat format
Definition syms_pe_parser.h:16
SYMS_PeGuid dbg_guid
Definition syms_pe_parser.h:29
SYMS_B32 is_pe32
Definition syms_pe_parser.h:19
SYMS_U64 section_count
Definition syms_pe_parser.h:23
SYMS_U64 dbg_path_off
Definition syms_pe_parser.h:27
SYMS_U64Range * data_dir_franges
Definition syms_pe_parser.h:33
SYMS_U64 dbg_path_size
Definition syms_pe_parser.h:28
SYMS_U64 symbol_count
Definition syms_pe_parser.h:25
SYMS_U64 file_section_align
Definition syms_pe_parser.h:21
SYMS_U32 dbg_age
Definition syms_pe_parser.h:30
SYMS_U32 data_dir_count
Definition syms_pe_parser.h:34
SYMS_U32 dbg_time
Definition syms_pe_parser.h:31
SYMS_Arch arch
Definition syms_pe_parser.h:32
SYMS_U64 entry_point
Definition syms_pe_parser.h:18
SYMS_U64 virt_section_align
Definition syms_pe_parser.h:20
SYMS_U64 symbol_array_off
Definition syms_pe_parser.h:24
SYMS_U64 section_array_off
Definition syms_pe_parser.h:22
SYMS_U64 string_table_off
Definition syms_pe_parser.h:26
Definition syms_pe.h:82
Definition syms_pe.h:91
Definition syms_meta_pe.h:161
Definition syms_meta_pe.h:219
SYMS_PeDebugDirectoryType type
Definition syms_meta_pe.h:224
SYMS_U32 file_offset
Definition syms_meta_pe.h:227
Definition syms_pe.h:110
Definition syms_pe.h:126
SYMS_U32 export_address_table_voff
Definition syms_pe.h:135
SYMS_U32 name_voff
Definition syms_pe.h:131
SYMS_U32 ordinal_table_voff
Definition syms_pe.h:137
SYMS_U32 export_address_table_count
Definition syms_pe.h:133
SYMS_U32 ordinal_base
Definition syms_pe.h:132
SYMS_U32 name_pointer_table_voff
Definition syms_pe.h:136
SYMS_U32 name_pointer_table_count
Definition syms_pe.h:134
Definition syms_pe_parser.h:10
SYMS_U32 coff_off
Definition syms_pe_parser.h:12
SYMS_FileFormat format
Definition syms_pe_parser.h:11
Definition syms_pe.h:71
Definition syms_pe_parser.h:65
SYMS_PeImportDll * import_dlls
Definition syms_pe_parser.h:66
SYMS_U64 count
Definition syms_pe_parser.h:67
Definition syms_pe_parser.h:59
Definition syms_pe.h:102
Definition syms_pe_parser.h:54
SYMS_PeImportName * names
Definition syms_pe_parser.h:55
SYMS_U64 count
Definition syms_pe_parser.h:56
Definition syms_pe_parser.h:47
SYMS_U16 ordinal
Definition syms_pe_parser.h:50
SYMS_PeImportLookup lookup
Definition syms_pe_parser.h:49
SYMS_String8 name
Definition syms_pe_parser.h:48
Definition syms_pe.h:62
Definition syms_meta_pe.h:111
Definition syms_meta_pe.h:79
Definition syms_debug_info.h:21
Definition syms_base.h:306
Definition syms_base.h:296
SYMS_U8 * str
Definition syms_base.h:297
SYMS_U64 size
Definition syms_base.h:298
Definition syms_base.h:243
Definition syms_base.h:238
SYMS_U64 count
Definition syms_base.h:240
SYMS_U32 * u32
Definition syms_base.h:239
Definition syms_base.h:233
SYMS_U64 * u64
Definition syms_base.h:234
SYMS_U64 count
Definition syms_base.h:235
Definition syms_base.h:264
SYMS_U64 max
Definition syms_base.h:266
SYMS_U64 min
Definition syms_base.h:265
SYMS_API SYMS_ArenaTemp syms_get_scratch(SYMS_Arena **conflicts, SYMS_U64 conflict_count)
Definition syms_base.c:694
SYMS_API SYMS_U64Range syms_make_u64_range(SYMS_U64 min, SYMS_U64 max)
Definition syms_base.c:18
SYMS_API SYMS_String8 syms_based_range_read_string(void *base, SYMS_U64Range range, SYMS_U64 offset)
Definition syms_base.c:823
SYMS_API void syms_arena_temp_end(SYMS_ArenaTemp temp)
Definition syms_base.c:689
SYMS_API SYMS_U64Range syms_make_u64_inrange(SYMS_U64Range range, SYMS_U64 offset, SYMS_U64 size)
Definition syms_base.c:24
SYMS_API SYMS_String8 syms_str8(SYMS_U8 *str, SYMS_U64 size)
Definition syms_base.c:169
SYMS_API SYMS_String8 syms_push_string_copy(SYMS_Arena *arena, SYMS_String8 string)
Definition syms_base.c:353
SYMS_API SYMS_String8List syms_string_split(SYMS_Arena *arena, SYMS_String8 input, SYMS_U32 delimiter)
Definition syms_base.c:390
SYMS_API SYMS_ArenaTemp syms_arena_temp_begin(SYMS_Arena *arena)
Definition syms_base.c:682
#define syms_true
Definition syms_base.h:105
#define SYMS_U16_MAX
Definition syms_base.h:174
#define syms_based_range_read_struct(b, r, o, p)
Definition syms_base.h:593
#define syms_push_array(a, T, c)
Definition syms_base.h:561
#define syms_memzero_struct(s)
Definition syms_base.h:161
#define SYMS_ClampTop(a, b)
Definition syms_base.h:182
#define syms_memisnull_struct(s)
Definition syms_base.h:162
#define syms_false
Definition syms_base.h:104
#define SYMS_API
Definition syms_base.h:29
#define SYMS_ARRAY_SIZE(x)
Definition syms_base.h:144
#define SYMS_ASSERT(x)
Definition syms_base.h:125
SYMS_S32 SYMS_B32
Definition syms_base.h:99
#define syms_push_array_zero(a, T, c)
Definition syms_base.h:564
SYMS_S8 SYMS_B8
Definition syms_base.h:97
#define SYMS_AlignDownPow2(a, b)
Definition syms_base.h:188
#define syms_str8_lit(s)
Definition syms_base.h:483
#define SYMS_QueuePush(f, l, n)
Definition syms_base.h:220
#define syms_release_scratch
Definition syms_base.h:567
uint32_t SYMS_U32
Definition syms_crt_overrides.h:38
uint64_t SYMS_U64
Definition syms_crt_overrides.h:39
#define syms_memmove
Definition syms_crt_overrides.h:65
#define SYMS_U64
Definition syms_crt_overrides.h:54
uint16_t SYMS_U16
Definition syms_crt_overrides.h:37
uint8_t SYMS_U8
Definition syms_crt_overrides.h:36
SYMS_READ_ONLY SYMS_GLOBAL SYMS_FileFormat syms_format_nil
Definition syms_debug_info.h:398
#define SYMS_Arena
Definition syms_default_arena.h:61
@ SYMS_FileFormat_PE
Definition syms_meta_base.h:96
SYMS_Arch
Definition syms_meta_base.h:6
@ SYMS_Arch_X64
Definition syms_meta_base.h:8
@ SYMS_Arch_X86
Definition syms_meta_base.h:9
SYMS_API SYMS_Arch syms_arch_from_coff_machine_type(SYMS_CoffMachineType v)
Definition syms_meta_coff.c:7
@ SYMS_CoffSectionFlag_CNT_UNINITIALIZED_DATA
Definition syms_meta_coff.h:90
@ SYMS_PeDataDirectoryIndex_EXPORT
Definition syms_meta_pe.h:143
@ SYMS_PeDataDirectoryIndex_EXCEPTIONS
Definition syms_meta_pe.h:146
@ SYMS_PeDataDirectoryIndex_IMPORT
Definition syms_meta_pe.h:144
@ SYMS_PeDataDirectoryIndex_DEBUG
Definition syms_meta_pe.h:149
@ SYMS_PeDataDirectoryIndex_DELAY_IMPORT
Definition syms_meta_pe.h:156
@ SYMS_PeDebugDirectoryType_CODEVIEW
Definition syms_meta_pe.h:169
#define SYMS_CODEVIEW_PDB20_MAGIC
Definition syms_pe.h:79
#define SYMS_PE_MAGIC
Definition syms_pe.h:35
#define SYMS_CODEVIEW_PDB70_MAGIC
Definition syms_pe.h:80
#define SYMS_PE32PLUS_MAGIC
Definition syms_pe.h:37
#define SYMS_DOS_MAGIC
Definition syms_pe.h:30
#define SYMS_PE32_MAGIC
Definition syms_pe.h:36
SYMS_API SYMS_String8 syms_pe_binary_name_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeBinAccel *bin)
Definition syms_pe_parser.c:852
SYMS_API SYMS_ImportArray syms_pe_imports_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeBinAccel *bin)
Definition syms_pe_parser.c:234
SYMS_API void * syms_pe_ptr_from_voff(SYMS_String8 data, SYMS_PeBinAccel *bin, SYMS_U64 voff)
Definition syms_pe_parser.c:533
SYMS_API SYMS_U64 syms_pe_foff_from_voff(SYMS_CoffSectionHeader *sections, SYMS_U32 section_count, SYMS_U64 virt_off)
Definition syms_pe_parser.c:556
SYMS_API SYMS_U64 syms_pe_binary_search_intel_pdata(SYMS_String8 data, SYMS_PeBinAccel *bin, SYMS_U64 voff)
Definition syms_pe_parser.c:440
SYMS_API SYMS_ExtFileList syms_pe_ext_file_list_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeBinAccel *bin)
Definition syms_pe_parser.c:206
SYMS_API SYMS_U64Array syms_u64_array_from_null_term_u64_string(SYMS_Arena *arena, SYMS_U64 *src, SYMS_U64 *opl)
Definition syms_pe_parser.c:578
SYMS_API SYMS_U64 syms_pe_entry_point_voff_from_bin(SYMS_PeBinAccel *bin)
Definition syms_pe_parser.c:228
SYMS_API SYMS_PeImportDllArray syms_pe_regular_imports_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeBinAccel *bin)
Definition syms_pe_parser.c:720
SYMS_API SYMS_SecInfoArray syms_pe_sec_info_array_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeBinAccel *bin)
Definition syms_pe_parser.c:222
SYMS_API SYMS_U64Array syms_pe_u64_array_from_null_term_addr_string(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeBinAccel *bin, SYMS_U64 foff)
Definition syms_pe_parser.c:610
SYMS_API SYMS_PeImportName syms_pe_import_name_from_name_entry(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeBinAccel *bin, SYMS_U64 name_entry)
Definition syms_pe_parser.c:627
SYMS_API SYMS_U64 syms_pe_sec_number_from_voff(SYMS_String8 data, SYMS_PeBinAccel *bin, SYMS_U64 voff)
Definition syms_pe_parser.c:495
SYMS_API SYMS_Arch syms_pe_arch_from_bin(SYMS_PeBinAccel *bin)
Definition syms_pe_parser.c:200
SYMS_API void * syms_pe_ptr_from_sec_number(SYMS_String8 data, SYMS_PeBinAccel *bin, SYMS_U64 n)
Definition syms_pe_parser.c:510
SYMS_API SYMS_PeBinAccel * syms_pe_bin_accel_from_file(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeFileAccel *accel)
Definition syms_pe_parser.c:31
SYMS_API void * syms_pe_ptr_from_foff(SYMS_String8 data, SYMS_PeBinAccel *bin, SYMS_U64 foff)
Definition syms_pe_parser.c:524
SYMS_API SYMS_ExportArray syms_pe_exports_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeBinAccel *bin)
Definition syms_pe_parser.c:293
SYMS_API SYMS_PeImportDllArray syms_pe_delayed_imports_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeBinAccel *bin)
Definition syms_pe_parser.c:780
SYMS_API SYMS_U64Array syms_u64_array_from_null_term_u32_string(SYMS_Arena *arena, SYMS_U32 *src, SYMS_U32 *opl)
Definition syms_pe_parser.c:592
SYMS_API SYMS_U64 syms_pe_bin_foff_from_voff(SYMS_String8 data, SYMS_PeBinAccel *bin, SYMS_U64 virt_off)
Definition syms_pe_parser.c:571
SYMS_API SYMS_PeImportNameArray syms_pe_import_name_array_from_name_entries(SYMS_Arena *arena, SYMS_String8 data, SYMS_PeBinAccel *bin, SYMS_U64Array name_entries)
Definition syms_pe_parser.c:670
SYMS_API SYMS_PeFileAccel * syms_pe_file_accel_from_data(SYMS_Arena *arena, SYMS_String8 data)
Definition syms_pe_parser.c:10
@ SYMS_PeImportLookup_NameHint
Definition syms_pe_parser.h:43
@ SYMS_PeImportLookup_Ordinal
Definition syms_pe_parser.h:42
SYMS_API SYMS_SecInfoArray syms_pecoff_sec_info_from_coff_sec(SYMS_Arena *arena, SYMS_String8 data, SYMS_U64 sec_hdrs_off, SYMS_U64 sec_count)
Definition syms_pecoff_helpers.c:86