fileIO.h: Add new function FileIO_CreateRetry().
config.h: Add new function Config_TriToBool().
hostinfo.h: Add new function Hostinfo_EnumerateAllProcessPids().
hostname.c: Allow hostname to be UTF8.
posixPosix.c: Using __GLIBC__ define to control use of euidaccess().
vmxnet3_defs.h: Update the coalescing configuration through the guest OS.
Bump the Tx Data Desc Max Size to 2048.
The drag-n-drop plugin clipboard updated to allow the clipboard size to be adjusted by the consumer via new CPClipboard_InitWithSize() function.
Common source and header file changes that are not applicable to open-vm-tools.
static Bool
AsyncSocketOSVersionSupportsV4Mapped()
{
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(VM_WIN_UWP)
OSVERSIONINFOW osvi = {sizeof(OSVERSIONINFOW)};
/*
/*
*----------------------------------------------------------------------
*
- * FileIO_Create --
+ * FileIO_CreateRetry --
*
* Open/create a file; specify creation mode
*
*/
FileIOResult
-FileIO_Create(FileIODescriptor *file, // OUT:
- const char *pathName, // IN:
- int access, // IN:
- FileIOOpenAction action, // IN:
- int mode) // IN: mode_t for creation
+FileIO_CreateRetry(FileIODescriptor *file, // OUT:
+ const char *pathName, // IN:
+ int access, // IN:
+ FileIOOpenAction action, // IN:
+ int mode, // IN: mode_t for creation
+ uint32 msecMaxWaitTime) // IN:
{
- return FileIOCreateRetry(file, pathName, access, action, mode, 0);
+ return FileIOCreateRetry(file, pathName, access, action, mode,
+ msecMaxWaitTime);
}
/*
*----------------------------------------------------------------------
*
- * FileIO_Open --
+ * FileIO_Create --
*
- * Open/create a file.
+ * Open/create a file; specify creation mode
*
* Results:
* FILEIO_SUCCESS on success: 'file' is set
*/
FileIOResult
-FileIO_Open(FileIODescriptor *file, // OUT:
- const char *pathName, // IN:
- int access, // IN:
- FileIOOpenAction action) // IN:
+FileIO_Create(FileIODescriptor *file, // OUT:
+ const char *pathName, // IN:
+ int access, // IN:
+ FileIOOpenAction action, // IN:
+ int mode) // IN: mode_t for creation
{
- return FileIO_OpenRetry(file, pathName, access, action, 0);
+ return FileIOCreateRetry(file, pathName, access, action, mode, 0);
}
}
+/*
+ *----------------------------------------------------------------------
+ *
+ * FileIO_Open --
+ *
+ * Open/create a file.
+ *
+ * Results:
+ * FILEIO_SUCCESS on success: 'file' is set
+ * FILEIO_OPEN_ERROR_EXIST if the file already exists
+ * FILEIO_FILE_NOT_FOUND if the file is not present
+ * FILEIO_ERROR for other errors
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+FileIOResult
+FileIO_Open(FileIODescriptor *file, // OUT:
+ const char *pathName, // IN:
+ int access, // IN:
+ FileIOOpenAction action) // IN:
+{
+ return FileIO_OpenRetry(file, pathName, access, action, 0);
+}
+
+
/*
*----------------------------------------------------------------------
*
#include <string.h>
#ifdef _WIN32
-#include "win32u.h"
+#include "windowsu.h"
#endif
#include <shlobj.h>
#include "productState.h"
#include "winregistry.h"
-#include "win32util.h"
+#include "windowsUtil.h"
#endif
/*
Bool Config_GetDataFileKeys(struct KeySafeUserRing **parentKeys,
struct KeySafeUserRing **allKeys);
+Bool Config_TriToBool(Bool boolDefaultValue,
+ int32 triValue);
+
#endif // _CONFIG_H_
FileIOOpenAction action,
int mode);
+FileIOResult FileIO_CreateRetry(FileIODescriptor *file,
+ const char *pathName,
+ int access,
+ FileIOOpenAction action,
+ int mode,
+ uint32 msecMaxWaitTime);
+
FileIOResult FileIO_Open(FileIODescriptor *file,
const char *pathName,
int access,
Bool Hostinfo_TSCInvariant(void);
DWORD Hostinfo_OpenProcessBits(void);
DWORD Hostinfo_OpenThreadBits(void);
+int Hostinfo_EnumerateAllProcessPids(uint32 **processIds);
#else
void Hostinfo_ResetProcessState(const int *keepFds,
size_t numKeepFds);
#if defined(_WINSOCKAPI_) || defined(_WINSOCK2API_)
#include <winbase.h>
#include "vm_atomic.h"
-
+#if defined(VM_WIN_UWP)
+/* UWP use the network definition in winsock2.h */
+#include <winsock2.h>
+#endif
/*
*----------------------------------------------------------------------
#endif
#include <signal.h>
-#ifndef __ANDROID__
#include <sys/ucontext.h>
-#endif
-#if __linux__
+#if __linux__ && !defined __ANDROID__
# if defined(__x86_64__)
# undef REG_RAX
# undef REG_RBX
#define SC_EIP(uc) ((unsigned long) (uc)->uc_mcontext.gregs[EIP])
#endif
#elif defined(ANDROID_X86)
-#define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.eax)
-#define SC_EBX(uc) ((unsigned long) (uc)->uc_mcontext.ebx)
-#define SC_ECX(uc) ((unsigned long) (uc)->uc_mcontext.ecx)
-#define SC_EDX(uc) ((unsigned long) (uc)->uc_mcontext.edx)
-#define SC_EDI(uc) ((unsigned long) (uc)->uc_mcontext.edi)
-#define SC_ESI(uc) ((unsigned long) (uc)->uc_mcontext.esi)
-#define SC_EBP(uc) ((unsigned long) (uc)->uc_mcontext.ebp)
-#define SC_ESP(uc) ((unsigned long) (uc)->uc_mcontext.esp)
-#define SC_EIP(uc) ((unsigned long) (uc)->uc_mcontext.eip)
+#define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EAX])
+#define SC_EBX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EBX])
+#define SC_ECX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_ECX])
+#define SC_EDX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EDX])
+#define SC_EDI(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EDI])
+#define SC_ESI(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_ESI])
+#define SC_EBP(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EBP])
+#define SC_ESP(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_ESP])
+#define SC_EIP(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EIP])
#else
#ifdef __x86_64__
#define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[GNU_REG_RAX])
struct timeval;
-#ifdef _WIN32
+/*struct timespec is not supported on UWP*/
+#if defined(_WIN32) && !defined(VM_WIN_UWP)
struct timespec {
time_t tv_sec;
long tv_nsec;
AtomicEpilogue();
#endif /* VM_X86_ANY */
#elif defined _MSC_VER
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(VM_ARM_32)
_InterlockedAnd((long *)&var->value, (long)val);
#else
__asm mov eax, val
AtomicEpilogue();
#endif /* VM_X86_ANY */
#elif defined _MSC_VER
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(VM_ARM_32)
_InterlockedOr((long *)&var->value, (long)val);
#else
__asm mov eax, val
AtomicEpilogue();
#endif /* VM_X86_ANY */
#elif defined _MSC_VER
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(VM_ARM_32)
_InterlockedXor((long *)&var->value, (long)val);
#else
__asm mov eax, val
return equal;
#endif //VM_ARM_V7
#elif defined _MSC_VER
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(VM_ARM_32)
return (__int64)*oldVal == _InterlockedCompareExchange64((__int64 *)&var->value,
(__int64)*newVal,
(__int64)*oldVal);
{
#ifdef VM_X86_64
__stosw((uint16*)dst, val, count);
+#elif defined(VM_ARM_32)
+ size_t i;
+ for (i = 0; i < count; i++) {
+ ((uint16 *)dst)[i] = val;
+ }
#else
__asm { pushf;
mov ax, val;
{
#ifdef VM_X86_64
__stosd((unsigned long*)dst, (unsigned long)val, count);
+#elif defined(VM_ARM_32)
+ size_t i;
+ for (i = 0; i < count; i++) {
+ ((uint32 *)dst)[i] = val;
+ }
#else
__asm { pushf;
mov eax, val;
: "0" (v)
);
return v;
-#elif defined(VM_ARM_32) && !defined(__ANDROID__)
+#elif defined(VM_ARM_32) && !defined(__ANDROID__) && !defined(_MSC_VER)
__asm__("rev %0, %0" : "+r"(v));
return v;
#elif defined(VM_ARM_64)
__asm__("rev32 %x0, %x0" : "+r"(v));
- return v;
+ return v;
#else
return (v >> 24)
| ((v >> 8) & 0xFF00)
*/
static INLINE void
PAUSE(void)
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(VM_ARM_32)
{
#ifdef VM_ARM_ANY
/*
{
return __rdtsc();
}
+#elif defined(VM_ARM_32)
+{
+ /*
+ * We need to do more inverstagetion here to find
+ * a microsoft equivalent of that code
+ */
+ NOT_IMPLEMENTED();
+ return 0;
+}
#else
#pragma warning( disable : 4035)
{
#ifdef _WIN32 // {
+/* Conflict with definition of Visual Studio 2015 */
+#if (_MSC_VER < 1900)
#define snprintf _snprintf
+#endif
+
#define strtok_r strtok_s
#if (_MSC_VER < 1500)
#endif
#define CONST const
-
#ifndef INLINE
# ifdef _MSC_VER
-# define INLINE __inline
+ /*
+ * On UWP(Universal Windows Platform),
+ * Only X86 32bit support '__inline'
+ */
+# if defined(VM_WIN_UWP) && !defined(VM_X86_32)
+# define INLINE
+# else
+# define INLINE __inline
+# endif
# else
# define INLINE inline
# endif
* versioning is correct.
*/
#if defined(VMX86_VIEWCLIENT)
- #define PRODUCT_VERSION 4,0,0,PRODUCT_BUILD_NUMBER_NUMERIC
+ #define PRODUCT_VERSION 4,1,0,PRODUCT_BUILD_NUMBER_NUMERIC
#elif defined(VMX86_VMRC) /* check VMX86_VMRC before VMX86_DESKTOP */
#define PRODUCT_VERSION 8,0,0,PRODUCT_BUILD_NUMBER_NUMERIC /* VMRC_VERSION_NUMBER below has to match this */
#elif defined(VMX86_FLEX) /* check VMX86_FLEX before VMX86_DESKTOP */
#define PRECHECK_VERSION "e.x.p"
#define VIEW_FEATUREPACK_VERSION "5.2.0"
#define VIEW_CLIENT_VERSION_NUMBER "4.0.0"
-#define VIEW_CLIENT_VERSION "4.0.0"
+#define VIEW_CLIENT_VERSION "4.1.0"
#define VHSESDK_VERSION "1.0.0"
#define RDE_RFT_ALL_VERSION "4.0.0"
#define RDESDK_VERSION "2.0.0"
+++ /dev/null
-/*********************************************************
- * Copyright (C) 1998-2016 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- *********************************************************/
-
-/*
- * Win32Util.h --
- *
- * misc Windows utilities
- */
-
-#ifndef WIN32UTIL_H_
-#define WIN32UTIL_H_
-
-#define INCLUDE_ALLOW_USERLEVEL
-#include "includeCheck.h"
-
-#include "vm_basic_types.h"
-#include "vm_atomic.h"
-#include "unicodeTypes.h"
-
-#ifdef _WIN32
-
-#include <windows.h>
-
-/* Type definitions */
-
-typedef enum AutorunState {
- AUTORUN_UNDEFINED,
- AUTORUN_ON,
- AUTORUN_OFF
-} AutorunState;
-
-/* Defines */
-#define VMX_SHUTDOWN_ORDER 0x100 // Application reserved last shutdown range.
-#define UI_SHUTDOWN_ORDER 0x300 // Application reserved first shutdown range.
-#define TOOLS_SHUTDOWN_ORDER 0x100 // Application reserved last shutdown range
-
-/* Function declarations */
-
-char * W32Util_GetInstallPath(void);
-char * W32Util_GetInstallPath64(void);
-
-/*
- * The string returned is allocated on the heap and must be freed by the
- * calling routine.
- */
-
-
-char *W32Util_GetAppDataFilePath(const char *fileName);
-char *W32Util_GetLocalAppDataFilePath(const char *fileName);
-
-char *W32Util_GetCommonAppDataFilePath(const char *fileName);
-char *W32Util_GetVmwareCommonAppDataFilePath(const char *fileName);
-
-char *W32Util_GetMyDocumentPath(void);
-char *W32Util_GetMyVideoPath(BOOL myDocumentsOnFail);
-
-char *W32Util_GetDefaultVMPath(const char *pref);
-char *W32Util_GetInstalledFilePath(const char *fileName);
-char *W32Util_GetInstalledFilePath64(const char *fileName);
-
-HKEY W32Util_OpenProductRegKey(REGSAM access);
-HKEY W32Util_OpenUserRegKey(REGSAM access);
-
-LPTOP_LEVEL_EXCEPTION_FILTER W32Util_SetUnhandledExceptionFilter(void);
-
-
-Bool W32Util_CreateProcessArgv(const char *lpApplicationName,
- const char **argv,
- LPSECURITY_ATTRIBUTES lpProcessAttributes,
- LPSECURITY_ATTRIBUTES lpThreadAttributes,
- BOOL bInheritHandles,
- DWORD dwCreationFlags,
- LPVOID lpEnvironment,
- const char *lpCurrentDirectory,
- LPSTARTUPINFOA lpStartupInfo,
- LPPROCESS_INFORMATION lpProcessInformation);
-
-void W32Util_SplitCommandLine(char *commandLine,
- int maxArgs,
- char *progName,
- int *argc,
- char **argv);
-
-BOOL W32Util_ReadFileTimeout(HANDLE hFile, // handle of file to read
- LPVOID lpBuffer, // pointer to buffer that receives data
- DWORD nNumberOfBytesToRead, // number of bytes to read
- LPDWORD lpNumberOfBytesRead, // pointer to number of bytes read
- DWORD msTimeout); // timeout in milliseconds
-
-BOOL W32Util_WriteFileTimeout(HANDLE hFile, // handle to file to write to
- LPCVOID lpBuffer, // pointer to data to write to file
- DWORD nNumberOfBytesToWrite, // number of bytes to write
- LPDWORD lpNumberOfBytesWritten, // pointer to number of bytes written
- DWORD msTimeout); // timeout in milliseconds
-
-char *W32Util_RealPath(const char *path);
-
-BOOL W32Util_CheckForPrivilegeHeld(HANDLE token, LPCTSTR priv);
-
-typedef BOOL (*SidFilterFunction)(PSID psid, void *cbData);
-BOOL W32Util_GetEffectiveRightsForName(const char *user,
- const char *path,
- DWORD *rights);
-BOOL W32Util_GetEffectiveRightsForSid(PSID psid,
- const char *path,
- DWORD *rights);
-
-BOOL W32Util_ModifyRights(PSID psid,
- const char *path,
- DWORD rights,
- BOOL isAllow);
-void W32Util_FreeSids(PSID *sidList);
-BOOL W32Util_GetMatchingSids(const char *path,
- PSID **psidList,
- SidFilterFunction matchCb,
- void *cbData);
-
-LPSTR W32Util_WideStrToAsciiStr(LPCWSTR wideStr);
-LPWSTR W32Util_AsciiStrToWideStr(LPCSTR multiStr);
-LPSTR W32Util_WideStrToMultiByteStr(LPCWSTR wideStr, UINT codePage);
-LPWSTR W32Util_MultiByteStrToWideStr(LPCSTR multiStr, UINT codePage);
-
-BOOL W32Util_WinSockAddReference(void);
-BOOL W32Util_WinSockDereference(void);
-
-Bool W32Util_RegisterService(Bool bRegister,
- const char *name,
- const char *displayName,
- const char *description,
- const char *binaryPath,
- char **errString);
-
-Bool W32Util_DebugService(const char *dbgFile);
-
-Bool W32Util_RegisterEventLog(const char *serviceName,
- Bool registryVolatile,
- DWORD typesSupported,
- const char *eventMsgFile,
- const char *categoryMsgFile,
- DWORD categoryCount,
- const char *paramMsgFile);
-
-Bool W32Util_UnregisterEventLog(const char *serviceName);
-
-typedef enum SetSDPrivsAccounts {
- SDPRIV_GROUP_ADMIN = 0x1,
- SDPRIV_GROUP_VMWARE = 0x2,
- SDPRIV_USER_CURRENT = 0x4,
-} SetSDPrivsAccounts;
-
-Bool W32Util_SetSDPrivs(PSECURITY_DESCRIPTOR pSecurityDescriptor,
- DWORD accessType, SetSDPrivsAccounts accounts,
- PACL *pAcl, char **errString);
-
-BOOL W32Util_SetSecurityDescriptorW(PSECURITY_DESCRIPTOR pSecurityDescriptor,
- const char *Owner, PACL *pAcl);
-BOOL W32Util_SetSecurityDescriptorSid(PSECURITY_DESCRIPTOR sd, PSID sid,
- PACL *pAcl);
-BOOL W32Util_GetThreadHandle(HANDLE *handle);
-
-Bool W32Util_AccessCheck(HANDLE token,
- PSECURITY_DESCRIPTOR pSecurityDescriptor,
- int desiredAccess);
-
-Bool W32Util_HasAccessToFile(const char *filename, ACCESS_MASK desiredAccess,
- HANDLE token);
-
-Bool W32Util_GetSecurityDescriptor(const char *path,
- PSECURITY_DESCRIPTOR *ppSecurityDescriptor);
-
-void W32Util_InitStdioConsole(void);
-void W32Util_ExitStdioConsole(void);
-
-Bool W32Util_CreateWellKnownSid(WELL_KNOWN_SID_TYPE wsdType,
- PSID domainSid,
- PSID *pSid);
-
-Bool W32Util_GetCurrentUserSid(PSID *pSid);
-Bool W32Util_GetLocalAdminGroupSid(PSID *pSid);
-Bool W32Util_GetVMwareGroupSid(PSID *pSid);
-Bool W32Util_MakeSafeDirectory(const char *path);
-Bool W32Util_IsDirectorySafe(const char *path);
-Bool W32Util_DoesVolumeSupportAcls(const char *path);
-
-Bool W32Util_GetRegistryAutorun(AutorunState* state);
-Bool W32Util_SetRegistryAutorun(const AutorunState state);
-
-Bool W32Util_AllowAdminCOM(void);
-
-char * W32Util_GetAppDataPath(void);
-char * W32Util_RobustGetLongPath(const char *path);
-
-typedef enum SecureObjectType {
- SecureObject_Process,
- SecureObject_Thread
-} SecureObjectType;
-
-PSECURITY_DESCRIPTOR W32Util_ConstructSecureObjectSD(HANDLE hToken,
- SecureObjectType type);
-Bool W32Util_ReplaceObjectSD(HANDLE hObject,
- const PSECURITY_DESCRIPTOR pSD);
-
-HMODULE W32Util_GetModuleByAddress(const void *addr);
-
-Bool W32Util_VerifyXPModeHostLicense(void);
-
-char * W32Util_GetPipeNameFromFilePath(const char *fileName);
-
-Bool W32Util_CheckGroupMembership(HANDLE hToken,
- BOOL respectUAC,
- char * *errString,
- BOOL *bMember);
-
-Bool W32Util_DismountVolumes(uint16 drive,
- uint64 offset,
- uint64 size,
- void **handle);
-Bool W32Util_CloseDismountHandle(void *handle);
-
-Bool W32Util_EnableSafePathSearching(void);
-
-CRITICAL_SECTION *W32Util_GetSingletonCriticalSection(Atomic_Ptr *csMemory);
-
-#endif // _WIN32
-#endif // WIN32UTIL_H_
--- /dev/null
+/*********************************************************
+ * Copyright (C) 1998-2016 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *********************************************************/
+
+/*
+ * WindowsUtil.h --
+ *
+ * misc Windows utilities
+ */
+
+#ifndef WINDOWSUTIL_H_
+#define WINDOWSUTIL_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#include "includeCheck.h"
+
+#include "vm_basic_types.h"
+#include "vm_atomic.h"
+#include "unicodeTypes.h"
+
+#ifdef _WIN32
+
+/* Defines */
+#define VMX_SHUTDOWN_ORDER 0x100 // Application reserved last shutdown range.
+#define UI_SHUTDOWN_ORDER 0x300 // Application reserved first shutdown range.
+#define TOOLS_SHUTDOWN_ORDER 0x100 // Application reserved last shutdown range
+
+#include <windows.h>
+
+#if !defined(VM_WIN_UWP)
+#include "win32Util.h"
+#endif
+
+
+/* Function declarations */
+
+char * W32Util_GetInstallPath(void);
+char * W32Util_GetInstallPath64(void);
+
+/*
+ * The string returned is allocated on the heap and must be freed by the
+ * calling routine.
+ */
+
+char *W32Util_GetAppDataFilePath(const char *fileName);
+char *W32Util_GetLocalAppDataFilePath(const char *fileName);
+
+char *W32Util_GetCommonAppDataFilePath(const char *fileName);
+char *W32Util_GetVmwareCommonAppDataFilePath(const char *fileName);
+
+char *W32Util_GetMyDocumentPath(void);
+char *W32Util_GetMyVideoPath(BOOL myDocumentsOnFail);
+
+char *W32Util_GetDefaultVMPath(const char *pref);
+char *W32Util_GetInstalledFilePath(const char *fileName);
+char *W32Util_GetInstalledFilePath64(const char *fileName);
+
+CRITICAL_SECTION *W32Util_GetSingletonCriticalSection(Atomic_Ptr *csMemory);
+
+#endif // _WIN32
+#endif // WIN32UTIL_H_
if (syndrome == 0) {
#if defined(_WIN32)
- syndrome = GetTickCount();
+ syndrome = (uint32)GetTickCount64();
#else
syndrome = time(NULL) & 0xFFFFFFFF;
#endif
#include "ulInt.h"
#include "hostinfo.h"
#if defined(_WIN32)
-#include "win32u.h"
+#include "windowsu.h"
#endif
#define MXUSER_A_BILLION (1000 * 1000 * 1000)
#include "codeset.h"
#include "codesetOld.h"
#include "str.h"
-#include "win32util.h"
+#include "windowsUtil.h"
#if defined __APPLE__
# define LOCATION_WEAK
# include "location.h"
CodeSet_GetAltPathName(const utf16_t *pathW) // IN
{
char *path = NULL;
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(VM_WIN_UWP)
DWORD res;
utf16_t shortPathW[_MAX_PATH];
const char *
CodeSetOld_GetCurrentCodeSet(void)
{
-#if defined(CURRENT_IS_UTF8)
+#if defined(CURRENT_IS_UTF8) || defined(VM_WIN_UWP)
return "UTF-8";
#elif defined(_WIN32)
static char ret[20]; // max is "windows-4294967296"
static DWORD
GetInvalidCharsFlag(void)
{
+#if defined(VM_WIN_UWP)
+ return MB_ERR_INVALID_CHARS;
+#else
static volatile Bool bFirstCall = TRUE;
static DWORD retval;
#pragma warning(push)
#pragma warning(disable : 4996) // 'function': was declared deprecated
- if(!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi))) {
+ if (!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi))) {
/*
* If GetVersionEx failed, we are running something earlier than NT4+SP6,
* thus we cannot use MB_ERR_INVALID_CHARS
bFirstCall = FALSE;
return retval;
+#endif //VM_WIN_UWP
}
#endif
#include "log.h"
#include "hostinfo.h"
#if defined(_WIN32) // Windows
-#include "win32u.h"
+#include "windowsu.h"
#endif
#include "unicode.h"
if ((uname(&un) == 0) && (*un.nodename != '\0')) {
/* 'un.nodename' is already fully qualified. */
- result = Unicode_Alloc(un.nodename, STRING_ENCODING_US_ASCII);
+ if (Unicode_IsStringValidUTF8(un.nodename)) { // ASCII is OK
+ result = Unicode_Duplicate(un.nodename);
+ }
}
return result;
p = phe->h_name;
}
- result = Unicode_Alloc(p, STRING_ENCODING_US_ASCII);
+ if (Unicode_IsStringValidUTF8(p)) { // ASCII is OK
+ result = Unicode_Duplicate(p);
+ }
}
return result;
Posix_EuidAccess(const char *pathName, // IN:
int mode) // IN:
{
-#ifdef __linux__
+#if defined(__GLIBC__)
char *path;
int ret;
#if defined(_WIN32)
+#if !defined(VM_WIN_UWP)
/*
*-----------------------------------------------------------------------------
*
return TRUE;
}
+#endif // !VM_WIN_UWP
#else
/*
*-----------------------------------------------------------------------------
#include "str.h"
#include "util.h"
#ifdef _WIN32
-#include "win32u.h"
+#include "windowsu.h"
#endif
#include "unicode.h"
#if defined(_WIN32)
-#include "win32u.h"
-#include "win32util.h"
+#include "windowsu.h"
+#include "windowsUtil.h"
#endif
#if defined(__APPLE__)
#include "utilMacos.h"
strchr(VALID_DIRSEPS, driveSpec[1])) {
remoteDrive = TRUE;
} else {
+#if defined( VM_WIN_UWP)
+ /* Don't need remote path for UWP until now*/
+ remoteDrive = FALSE;
+#else
remoteDrive = (GetDriveTypeA(driveSpec) == DRIVE_REMOTE);
+#endif // !VM_WIN_UWP
}
/*
VThreadBaseKeyType newKey;
#if defined _WIN32
+#if defined VM_WIN_UWP
+ newKey = FlsAlloc(NULL);
+#else
newKey = TlsAlloc();
+#endif
VERIFY(newKey != VTHREADBASE_INVALID_KEY);
#else
Bool success = pthread_key_create(&newKey, deletePtr) == 0;
VTHREADBASE_INVALID_KEY) {
/* Race: someone else init'd */
#if defined _WIN32
+#if defined VM_WIN_UWP
+ FlsFree(newKey);
+#else
TlsFree(newKey);
+#endif
#else
pthread_key_delete(newKey);
#endif
}
ASSERT(key != VTHREADBASE_INVALID_KEY);
#if defined _WIN32
+#if defined VM_WIN_UWP
+ success = FlsSetValue(key, adjustedValue);
+#else
success = TlsSetValue(key, adjustedValue);
+#endif
#else
success = pthread_setspecific(key, adjustedValue) == 0;
#endif
ASSERT(VThreadBaseAreKeysInited());
#if defined _WIN32
+#if defined VM_WIN_UWP
+ result = FlsGetValue(key);
+#else
result = TlsGetValue(key);
+#endif
#else
result = pthread_getspecific(key);
#endif
static Bool
VThreadBaseNativeIsAlive(void *native)
{
+#if defined(VM_WIN_UWP)
+ /* OpenThread is not support on UWP */
+ NOT_IMPLEMENTED();
+
+ return FALSE;
+#else
+
// Different access level due to impersonation see PR#780775
HANDLE hThread = OpenThread(Hostinfo_OpenThreadBits(), FALSE,
(DWORD)(uintptr_t)native);
return exitCode == STILL_ACTIVE;
}
+#endif // VM_WIN_UWP
}
#endif
* would only cause missing a reclaim which isn't a problem.
* Posix: thread exit is hooked (via TLS destructor) and sets
* entries to NULL, so any entry that is NULL is reclaimable.
+ * UWP: There is no permission to check thread status with the
+ * thread id. There are only few threads in UWP client, ignore
+ * the reclaimation.
*/
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(VM_WIN_UWP)
void *oldNative;
reused = HashTable_Lookup(ht, newKey, &oldNative) &&
(oldNative == NULL ||
#include "coreDump.h"
#endif
#ifdef _WIN32
-#include "win32u.h"
+#include "windowsu.h"
#endif
typedef enum {
Util_HasAdminPriv(void)
{
#if defined(_WIN32)
+#if defined(VM_WIN_UWP)
+ return 0;
+#else
HANDLE token = INVALID_HANDLE_VALUE;
int ret = -1;
}
return ret;
+#endif // !VM_WIN_UWP
#else
return Id_IsSuperUser() ? 1 : 0;
#endif
#include "vmware.h"
#include "vm_version.h"
#include "vm_tools_version.h"
-#if !defined(WINNT_DDK)
-# include "hostinfo.h"
+#ifndef WINNT_DDK
+#include "hostinfo.h"
#endif
/*
ASSERT(type);
/* Make sure EBX does not contain BDOOR_MAGIC */
- bp.in.size = ~BDOOR_MAGIC;
+ bp.in.size = (size_t)~BDOOR_MAGIC;
/* Make sure ECX does not contain any known VMX type */
bp.in.cx.halfs.high = 0xFFFF;
# include <dbghelp.h>
# include "coreDump.h"
# include "w32Messages.h"
-# include "win32u.h"
+# include "windowsu.h"
#endif
#include "str.h"
#include "system.h"
VMXNET3_CMD_LOAD_PLUGIN,
VMXNET3_CMD_ACTIVATE_VF,
VMXNET3_CMD_SET_POLLING,
- VMXNET3_CMD_UPDATE_COALESCE,
+ VMXNET3_CMD_SET_COALESCE,
VMXNET3_CMD_REGISTER_MEMREGS,
VMXNET3_CMD_FIRST_GET = 0xF00D0000,
VMXNET3_CMD_GET_DEV_EXTRA_INFO,
VMXNET3_CMD_GET_CONF_INTR,
VMXNET3_CMD_GET_ADAPTIVE_RING_INFO,
- VMXNET3_CMD_GET_COALESCE,
VMXNET3_CMD_GET_TXDATA_DESC_SIZE
} Vmxnet3_Cmd;
#define VMXNET3_RC_RING_MAX_SIZE 8192
/* Large enough to accommodate typical payload + encap + extension header */
-#define VMXNET3_RXDATA_DESC_MAX_SIZE 2048
+#define VMXNET3_RXDATA_DESC_MAX_SIZE 2048
+#define VMXNET3_TXDATA_DESC_MIN_SIZE 128
+#define VMXNET3_TXDATA_DESC_MAX_SIZE 2048
-#define VMXNET3_TXDATA_DESC_MAX_SIZE 1024
/* a list of reasons for queue stop */
-#define VMXNET3_TXDATA_DESC_MIN_SIZE 128
+
#define VMXNET3_ERR_NOEOP 0x80000000 /* cannot find the EOP desc of a pkt */
#define VMXNET3_ERR_TXD_REUSE 0x80000001 /* reuse a TxDesc before tx completion */
#define VMXNET3_ERR_BIG_PKT 0x80000002 /* too many TxDesc for a pkt */
/* value of intrCtrl */
#define VMXNET3_IC_DISABLE_ALL 0x1 /* bit 0 */
+#define VMXNET3_COAL_STATIC_MAX_DEPTH 128
+#define VMXNET3_COAL_RBC_MIN_RATE 100
+#define VMXNET3_COAL_RBC_MAX_RATE 100000
+
+enum Vmxnet3_CoalesceMode {
+ VMXNET3_COALESCE_DEFAULT = 0,
+ VMXNET3_COALESCE_DISABLED = 1,
+ VMXNET3_COALESCE_ADAPT = 2,
+ VMXNET3_COALESCE_STATIC = 3,
+ VMXNET3_COALESCE_RBC = 4
+};
+
+typedef
+#include "vmware_pack_begin.h"
+struct Vmxnet3_CoalesceRbc {
+ uint32 rbc_rate;
+}
+#include "vmware_pack_end.h"
+Vmxnet3_CoalesceRbc;
+
+typedef
+#include "vmware_pack_begin.h"
+struct Vmxnet3_CoalesceStatic {
+ uint32 tx_depth;
+ uint32 tx_comp_depth;
+ uint32 rx_depth;
+}
+#include "vmware_pack_end.h"
+Vmxnet3_CoalesceStatic;
+
+typedef
+#include "vmware_pack_begin.h"
+struct Vmxnet3_CoalesceScheme {
+ enum Vmxnet3_CoalesceMode coalMode;
+ union {
+ Vmxnet3_CoalesceRbc coalRbc;
+ Vmxnet3_CoalesceStatic coalStatic;
+ } coalPara;
+}
+#include "vmware_pack_end.h"
+Vmxnet3_CoalesceScheme;
+
typedef
#include "vmware_pack_begin.h"
struct Vmxnet3_IntrConf {
*/
typedef struct {
Bool changed;
+ Bool isInitialized;
+ uint32 maxSize;
CPClipItem items[CPFORMAT_MAX - 1];
} CPClipboard;
ASSERT(clip);
clip->changed = TRUE;
+ clip->maxSize = CPCLIPITEM_MAX_SIZE_V3;
for (i = CPFORMAT_MIN; i < CPFORMAT_MAX; ++i) {
CPClipItemInit(&clip->items[CPFormatToIndex(i)]);
}
+ clip->isInitialized = TRUE;
+}
+
+
+/*
+ *----------------------------------------------------------------------------
+ *
+ * CPClipboard_InitWithSize --
+ *
+ * Call CPClipboard_Init and set the clipboard size.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------------
+ */
+
+void
+CPClipboard_InitWithSize(CPClipboard *clip, // IN/OUT: the clipboard
+ uint32 size) // IN: clipboard size
+{
+ ASSERT(clip);
+
+ CPClipboard_Init(clip);
+ clip->maxSize = size;
}
return FALSE;
}
- if (size >= CPCLIPITEM_MAX_SIZE_V3) {
+ if (size >= (size_t) clip->maxSize) {
return FALSE;
}
item->exists = TRUE;
/* Drop some data if total size is more than limit. */
- while (CPClipboard_GetTotalSize(clip) >= CPCLIPITEM_MAX_SIZE_V3 &&
+ while (CPClipboard_GetTotalSize(clip) >= (size_t) clip->maxSize &&
filterIndex < ARRAYSIZE(filterList)) {
if (!CPClipboard_ClearItem(clip, filterList[filterIndex])) {
return FALSE;
*buf = clip->items[CPFormatToIndex(fmt)].buf;
*size = clip->items[CPFormatToIndex(fmt)].size;
ASSERT(*buf);
- ASSERT((*size > 0) && (*size < CPCLIPITEM_MAX_SIZE_V3));
+ ASSERT((*size > 0) && (*size < clip->maxSize));
return TRUE;
} else {
ASSERT(!clip->items[CPFormatToIndex(fmt)].size);
}
}
dest->changed = src->changed;
+ dest->maxSize = src->maxSize;
+ dest->isInitialized = TRUE;
return TRUE;
}
ASSERT(clip);
ASSERT(buf);
+ ASSERT(clip->isInitialized);
+
+ /* Return FALSE if not initialized. */
+ if (!clip->isInitialized) {
+ return FALSE;
+ }
/* First append number of formats in clip. */
if (!DynBuf_Append(buf, &maxFmt, sizeof maxFmt)) {
ASSERT(clip);
ASSERT(buf);
+ ASSERT(clip->isInitialized);
- CPClipboard_Init(clip);
+ /* Return FALSE if not initialized. */
+ if (!clip->isInitialized) {
+ goto error;
+ }
r.pos = buf;
r.unreadLen = len;
/* CPClipboard */
void CPClipboard_Init(CPClipboard *clip);
+void CPClipboard_InitWithSize(CPClipboard *clip, uint32 size);
void CPClipboard_Destroy(CPClipboard *clip);
void CPClipboard_Clear(CPClipboard *clip);
/* Unserialize clipboard data for the command. */
buf = DnDMsg_GetArg(&msg, 0);
+ CPClipboard_Init(&clip);
if (!CPClipboard_Unserialize(&clip, DynBuf_Get(buf), DynBuf_GetSize(buf))) {
g_debug("%s: CPClipboard_Unserialize failed.\n", __FUNCTION__);
goto exit;
LOG(0, ("%s: invalid clipboard data.\n", __FUNCTION__));
break;
}
+ CPClipboard_Init(&clip);
if (!CPClipboard_Unserialize(&clip, (void *)binary, binarySize)) {
LOG(0, ("%s: CPClipboard_Unserialize failed.\n", __FUNCTION__));
break;
LOG(0, ("%s: invalid clipboard data.\n", __FUNCTION__));
break;
}
+ CPClipboard_Init(&clip);
if (!CPClipboard_Unserialize(&clip, (void *)binary, binarySize)) {
LOG(0, ("%s: CPClipboard_Unserialize failed.\n", __FUNCTION__));
break;
# include <Windows.h>
# include <WinSock2.h>
# include <WinSpool.h>
-# include "win32u.h"
+# include "windowsu.h"
#elif _WIN32
# include "win95.h"
#endif
#include <WTypes.h>
#include <io.h>
#include "wminic.h"
-#include "win32u.h"
+#include "windowsu.h"
#include <sys/stat.h>
#include <time.h>
#define SECURITY_WIN32
#ifdef _WIN32
#include "registryWin32.h"
-#include "win32u.h"
+#include "windowsu.h"
#endif /* _WIN32 */
#include "hgfsHelper.h"