~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201210021442

« back to all changes in this revision

Viewing changes to lib/include/vixOpenSource.h

  • Committer: Package Import Robot
  • Author(s): Nate Muench
  • Date: 2012-06-20 15:59:51 UTC
  • mfrom: (1.4.8)
  • Revision ID: package-import@ubuntu.com-20120620155951-6rupmpb0f70b52zr
Tags: 2012.05.21-724730-0ubuntu1
* Merging upstream version 2012.05.21-724730.
  - Fixes building against the current Quantal kernel. (LP: #1000344)
  - Fixes Quantal installation issues. (LP: #1019031)

* Sync with Debian
  - Updating to debhelper version 9.
  - Updating to standards version 3.9.3.
  - Updating copyright file machine-readable format version 1.0.
  - Building without multiarch paths for now

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
 
88
88
#ifdef _WIN32
89
89
VixError Vix_TranslateCOMError(HRESULT comError);
 
90
VixError Vix_TranslateGuestRegistryError(int systemError);
90
91
#endif
91
92
 
92
93
#endif // VIX_HIDE_BORA_DEPENDENCIES
93
94
 
 
95
 
 
96
/*
 
97
 * This is an expanded view of a VixError
 
98
 * Every VixError is a 64-bit int, so it can fit into this struct.
 
99
 *
 
100
 * The flags, extraErrorType, and extraError are all optional. They
 
101
 * do not have to be set for any error. In fact, these are guaranteed
 
102
 * to be all 0 when the error is VIX_OK. This means that any program
 
103
 * that checks (VIX_OK == err) or (VIX_OK != err) will always work.
 
104
 *
 
105
 * The basic error field is a Vix error value, and it's the lsb
 
106
 * of the new struct. This means that a 64-bit error can be assigned
 
107
 * enum constant, like an integer. For example, err = VIX_E_FAIL; works.
 
108
 * This just leaves the flags and extraError fields as 0.
 
109
 */
 
110
typedef
 
111
#include "vmware_pack_begin.h"
 
112
struct VixErrorFields {
 
113
   uint16   error;
 
114
 
 
115
   uint8    flags;
 
116
 
 
117
   uint8    extraErrorType;
 
118
   uint32   extraError;
 
119
}
 
120
#include "vmware_pack_end.h"
 
121
VixErrorFields;
 
122
 
 
123
/*
 
124
 * These are the flags for a Vix error.
 
125
 */
 
126
enum {
 
127
   VIX_ERRORFLAG_GUEST         = 0x0001,
 
128
   VIX_ERRORFLAG_REMOTE        = 0x0002,
 
129
};
 
130
 
 
131
/*
 
132
 * These are the types of extra error in a Vix error.
 
133
 */
 
134
enum {
 
135
   VIX_ERROREXTRATYPE_NONE          = 0,
 
136
   VIX_ERROREXTRATYPE_SNAPSHOT      = 1,
 
137
   VIX_ERROREXTRATYPE_DISKLIB       = 2,
 
138
   VIX_ERROREXTRATYPE_WINDOWS       = 3,
 
139
   VIX_ERROREXTRATYPE_LINUX         = 4,
 
140
   VIX_ERROREXTRATYPE_FILE          = 5,
 
141
   VIX_ERROREXTRATYPE_VMDB          = 6,
 
142
   VIX_ERROREXTRATYPE_AIO           = 7,
 
143
   VIX_ERROREXTRATYPE_CRYPTO        = 8,
 
144
   VIX_ERROREXTRATYPE_KEYSAFE       = 9,
 
145
   VIX_ERROREXTRATYPE_BLOCKLIST     = 10,
 
146
   VIX_ERROREXTRATYPE_V2I           = 11,
 
147
   VIX_ERROREXTRATYPE_MSGPOST       = 12,
 
148
};
 
149
 
 
150
 
 
151
/*
 
152
 * These are the types of extra error in a Vix error.
 
153
 */
 
154
#define VIX_ERROR_BASE_ERROR(err) ((VixErrorFields *) &err)->error
 
155
#define VIX_ERROR_EXTRA_ERROR(err) ((VixErrorFields *) &err)->extraError
 
156
#define VIX_ERROR_EXTRA_ERROR_TYPE(err) ((VixErrorFields *) &err)->extraErrorType
 
157
#define VIX_ERROR_FROM_GUEST(err) (((VixErrorFields *) &err)->flags & VIX_ERRORFLAG_GUEST)
 
158
#define VIX_ERROR_FROM_REMOTE(err) (((VixErrorFields *) &err)->flags & VIX_ERRORFLAG_REMOTE)
 
159
#define VIX_ERROR_SET_FROM_GUEST(err) (((VixErrorFields *) &err)->flags |= VIX_ERRORFLAG_GUEST)
 
160
#define VIX_ERROR_SET_FROM_REMOTE(err) (((VixErrorFields *) &err)->flags |= VIX_ERRORFLAG_REMOTE)
 
161
 
 
162
#define VIX_SET_GUEST_WINDOWS_ERROR(err, vixError, winError)          \
 
163
   do {                                                               \
 
164
      err = 0;                                                        \
 
165
      VIX_ERROR_BASE_ERROR(err) = vixError;                           \
 
166
      VIX_ERROR_EXTRA_ERROR(err) = winError;                          \
 
167
      VIX_ERROR_EXTRA_ERROR_TYPE(err) = VIX_ERROREXTRATYPE_WINDOWS;   \
 
168
      VIX_ERROR_SET_FROM_GUEST(err);                                  \
 
169
   } while (0)
 
170
 
 
171
#define VIX_ERROR_SET_ADDITIONAL_ERROR(err, vixError, additionalError)   \
 
172
   do {                                                                 \
 
173
      err = additionalError;                                             \
 
174
      err = (err << 32) | vixError;                                     \
 
175
   } while (0)
 
176
 
94
177
/*
95
178
 * This defines additional error codes.
96
179
 * The public error codes are defined in vix.h
105
188
   /* File Errors */
106
189
   VIX_E_DIRECTORY_NOT_EMPTY                       = 20006,
107
190
 
 
191
   VIX_E_GUEST_AUTH_MULIPLE_MAPPINGS               = 20007,
 
192
 
 
193
   /* Guest Reg Errors */
 
194
   VIX_E_REG_KEY_INVALID                           = 20008,
 
195
   VIX_E_REG_KEY_HAS_SUBKEYS                       = 20009,
 
196
   VIX_E_REG_VALUE_NOT_FOUND                       = 20010,
 
197
   VIX_E_REG_KEY_ALREADY_EXISTS                    = 20011,
 
198
 
 
199
   /* Generic Guest Errors */
 
200
   VIX_E_HGFS_MOUNT_FAIL                           = 20050,
 
201
 
108
202
   /* Reg Errors*/
109
203
   VIX_E_REG_INCORRECT_VALUE_TYPE                  = 25000
110
204
   /* WARNING. Do not exceed 2**16 */
181
275
   VIX_PROPERTY_GUEST_CHANGE_FILE_ATTRIBUTES_ENABLED   = 4555,
182
276
   VIX_PROPERTY_GUEST_INITIATE_FILE_TRANSFER_FROM_GUEST_ENABLED   = 4556,
183
277
   VIX_PROPERTY_GUEST_INITIATE_FILE_TRANSFER_TO_GUEST_ENABLED   = 4557,
 
278
   VIX_PROPERTY_GUEST_ADD_AUTH_PRINICPAL_ENABLED         = 4558,
 
279
   VIX_PROPERTY_GUEST_REMOVE_AUTH_PRINICPAL_ENABLED      = 4559,
 
280
   VIX_PROPERTY_GUEST_LIST_AUTH_PRINICPALS_ENABLED       = 4560,
 
281
   VIX_PROPERTY_GUEST_LIST_MAPPED_PRINICPALS_ENABLED     = 4561,
 
282
   VIX_PROPERTY_GUEST_CREATE_REGISTRY_KEY_ENABLED      = 4562,
 
283
   VIX_PROPERTY_GUEST_LIST_REGISTRY_KEYS_ENABLED       = 4563,
 
284
   VIX_PROPERTY_GUEST_DELETE_REGISTRY_KEY_ENABLED      = 4564,
 
285
   VIX_PROPERTY_GUEST_SET_REGISTRY_VALUE_ENABLED       = 4565,
 
286
   VIX_PROPERTY_GUEST_LIST_REGISTRY_VALUES_ENABLED     = 4566,
 
287
   VIX_PROPERTY_GUEST_DELETE_REGISTRY_VALUE_ENABLED    = 4567,
184
288
};
185
289
 
186
290
 
476
580
   VIX_FILE_ATTRIBUTE_SET_UNIX_PERMISSIONS   = 0x0040,
477
581
};
478
582
 
 
583
/*
 
584
 * Principal types for IdProvider management.
 
585
 */
 
586
typedef enum VixGuestAuthPrincipalType {
 
587
   VIX_GUEST_AUTH_PRINCIPAL_TYPE_NONE              = 0,
 
588
   VIX_GUEST_AUTH_PRINCIPAL_TYPE_NAMED             = 1,
 
589
   VIX_GUEST_AUTH_PRINCIPAL_TYPE_ANY               = 2,
 
590
} VixGuestAuthPrincipalType;
 
591
 
 
592
/*
 
593
 * Types for Windows Registry Management.
 
594
 */
 
595
 
 
596
/*
 
597
 * In a 64 bit Windows OS, the registry has two views: 32 bit and 64 bit.
 
598
 * Normally using "registry redirection", 32 bit applications automatically
 
599
 * access the 32 bit view, while 64 bit applications access 64 bit view.
 
600
 * However, applications can pass a flag to specifically access either 32
 
601
 * or 64 bit registry view, irrespective of their own bitness.
 
602
 *
 
603
 * NOTE: 32 bit windows will ignore these flags if passed.
 
604
 *
 
605
 * Based on the above, and on the fact that in our case 32 bit tools run only
 
606
 * on 32 bit windows and 64 bit tools run only on 64 bit windows, we get the
 
607
 * following registry view access matrix:
 
608
 * Application      wowNative            wow32             wow64
 
609
 * -----------      --------             -----             -----
 
610
 * 32 bit tools     32 bit view          32 bit view       32 bit view
 
611
 * 64 bit tools     64 bit view          32 bit view       64 bit view
 
612
 * So in essence, we always access 32 bit view UNLESS its 64 bit tools and user
 
613
 * has specified either wowNative or wow64 as the registry access flag.
 
614
 */
 
615
 
 
616
typedef enum VixRegKeyWowBitness {
 
617
   VIX_REGISTRY_KEY_WOW_NATIVE        = 0,
 
618
   VIX_REGISTRY_KEY_WOW_32            = 1,
 
619
   VIX_REGISTRY_KEY_WOW_64            = 2,
 
620
} VixRegKeyWowBitness;
 
621
 
 
622
typedef enum VixRegValueDataType {
 
623
   VIX_REGISTRY_VALUE_DWORD           = 0,
 
624
   VIX_REGISTRY_VALUE_QWORD           = 1,
 
625
   VIX_REGISTRY_VALUE_STRING          = 2,
 
626
   VIX_REGISTRY_VALUE_EXPAND_STRING   = 3,
 
627
   VIX_REGISTRY_VALUE_MULTI_STRING    = 4,
 
628
   VIX_REGISTRY_VALUE_BINARY          = 5,
 
629
} VixRegValueDataType;
479
630
 
480
631
/*
481
632
 *-----------------------------------------------------------------------------