xref: /reactos/sdk/lib/rossym_new/getraw.c (revision 4e5e72fa)
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 <ntddk.h>
11 #include <reactos/rossym.h>
12 #include "rossympriv.h"
13 
14 #define NDEBUG
15 #include <debug.h>
16 
17 ULONG
18 RosSymGetRawDataLength(PROSSYM_INFO RosSymInfo)
19 {
20   return sizeof(ROSSYM_HEADER)
21          + RosSymInfo->SymbolsCount * sizeof(ROSSYM_ENTRY)
22          + RosSymInfo->StringsLength;
23 }
24 
25 VOID
26 RosSymGetRawData(PROSSYM_INFO RosSymInfo, PVOID RawData)
27 {
28   PROSSYM_HEADER RosSymHeader;
29 
30   RosSymHeader = (PROSSYM_HEADER) RawData;
31   RosSymHeader->SymbolsOffset = sizeof(ROSSYM_HEADER);
32   RosSymHeader->SymbolsLength = RosSymInfo->SymbolsCount * sizeof(ROSSYM_ENTRY);
33   RosSymHeader->StringsOffset = RosSymHeader->SymbolsOffset + RosSymHeader->SymbolsLength;
34   RosSymHeader->StringsLength = RosSymInfo->StringsLength;
35 
36   memcpy((char *) RawData + RosSymHeader->SymbolsOffset, RosSymInfo->Symbols,
37          RosSymHeader->SymbolsLength);
38   memcpy((char *) RawData + RosSymHeader->StringsOffset, RosSymInfo->Strings,
39          RosSymHeader->StringsLength);
40 }
41 
42 /* EOF */
43