xref: /reactos/sdk/lib/rossym/getraw.c (revision d6eebaa4)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS kernel
4  * FILE:            lib/rossym/getraw.c
5  * PURPOSE:         Convert rossym info to raw external format
6  *
7  * PROGRAMMERS:     Ge van Geldorp (gvg@reactos.com)
8  */
9 
10 #include <ntdef.h>
11 #include <reactos/rossym.h>
12 #include "rossympriv.h"
13 
14 ULONG
15 RosSymGetRawDataLength(PROSSYM_INFO RosSymInfo)
16 {
17   return sizeof(ROSSYM_HEADER)
18          + RosSymInfo->SymbolsCount * sizeof(ROSSYM_ENTRY)
19          + RosSymInfo->StringsLength;
20 }
21 
22 VOID
23 RosSymGetRawData(PROSSYM_INFO RosSymInfo, PVOID RawData)
24 {
25   PROSSYM_HEADER RosSymHeader;
26 
27   RosSymHeader = (PROSSYM_HEADER) RawData;
28   RosSymHeader->SymbolsOffset = sizeof(ROSSYM_HEADER);
29   RosSymHeader->SymbolsLength = RosSymInfo->SymbolsCount * sizeof(ROSSYM_ENTRY);
30   RosSymHeader->StringsOffset = RosSymHeader->SymbolsOffset + RosSymHeader->SymbolsLength;
31   RosSymHeader->StringsLength = RosSymInfo->StringsLength;
32 
33   memcpy((char *) RawData + RosSymHeader->SymbolsOffset, RosSymInfo->Symbols,
34          RosSymHeader->SymbolsLength);
35   memcpy((char *) RawData + RosSymHeader->StringsOffset, RosSymInfo->Strings,
36          RosSymHeader->StringsLength);
37 }
38