1 | /** @file
|
---|
2 | *
|
---|
3 | * Testcase for shared folder structure sizes.
|
---|
4 | * Run this on Linux and Windows, then compare.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License as published by the Free Software Foundation,
|
---|
14 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | /*******************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *******************************************************************************/
|
---|
22 | #include <VBox/shflsvc.h>
|
---|
23 | #include <iprt/stream.h>
|
---|
24 |
|
---|
25 | #define STRUCT(t, size) \
|
---|
26 | do { \
|
---|
27 | if (fPrintChecks) \
|
---|
28 | RTPrintf(" STRUCT(" #t ", %d);\n", (int)sizeof(t)); \
|
---|
29 | else if ((size) != sizeof(t)) \
|
---|
30 | { \
|
---|
31 | RTPrintf("%30s: %d expected %d!\n", #t, (int)sizeof(t), (size)); \
|
---|
32 | cErrors++; \
|
---|
33 | } \
|
---|
34 | else \
|
---|
35 | RTPrintf("%30s: %d\n", #t, (int)sizeof(t)); \
|
---|
36 | } while (0)
|
---|
37 |
|
---|
38 |
|
---|
39 | int main(int argc, char **argv)
|
---|
40 | {
|
---|
41 | unsigned cErrors = 0;
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * Prints the code below if any argument was giving.
|
---|
45 | */
|
---|
46 | bool fPrintChecks = argc != 1;
|
---|
47 |
|
---|
48 | /*
|
---|
49 | * The checks.
|
---|
50 | */
|
---|
51 | STRUCT(SHFLROOT, 4);
|
---|
52 | STRUCT(SHFLHANDLE, 8);
|
---|
53 | STRUCT(SHFLSTRING, 6);
|
---|
54 | STRUCT(SHFLCREATERESULT, 4);
|
---|
55 | STRUCT(SHFLCREATEPARMS, 108);
|
---|
56 | STRUCT(SHFLMAPPING, 8);
|
---|
57 | STRUCT(SHFLDIRINFO, 128);
|
---|
58 | STRUCT(SHFLVOLINFO, 40);
|
---|
59 | STRUCT(VBoxSFQueryMappings, 52);
|
---|
60 | STRUCT(VBoxSFQueryMapName, 52);
|
---|
61 | STRUCT(VBoxSFMapFolder, 52);
|
---|
62 | STRUCT(VBoxSFUnmapFolder, 28);
|
---|
63 | STRUCT(VBoxSFCreate, 52);
|
---|
64 | STRUCT(VBoxSFClose, 40);
|
---|
65 | STRUCT(VBoxSFRead, 76);
|
---|
66 | STRUCT(VBoxSFWrite, 76);
|
---|
67 | STRUCT(VBoxSFLock, 76);
|
---|
68 | STRUCT(VBoxSFFlush, 40);
|
---|
69 | STRUCT(VBoxSFList, 112);
|
---|
70 | STRUCT(VBoxSFInformation, 76);
|
---|
71 | STRUCT(VBoxSFRemove, 52);
|
---|
72 | STRUCT(VBoxSFRename, 64);
|
---|
73 | STRUCT(VBoxSFAddMapping, 40);
|
---|
74 | STRUCT(VBoxSFRemoveMapping, 28);
|
---|
75 |
|
---|
76 | /*
|
---|
77 | * The summary.
|
---|
78 | */
|
---|
79 | if (!cErrors)
|
---|
80 | RTPrintf("tstShflSizes: SUCCESS\n");
|
---|
81 | else
|
---|
82 | RTPrintf("tstShflSizes: FAILURE - %d errors\n", cErrors);
|
---|
83 | return !!cErrors;
|
---|
84 | }
|
---|
85 |
|
---|