# Name

VixVM_SetSharedFolderState

# Description

    VixHandle
    VixVM_SetSharedFolderState(VixHandle vmHandle,
                               const char *shareName,
    			   const char *hostPathName,
                               VixMsgSharedFolderOptions flags,
    			   VixEventProc *callbackProc,
                               void *clientData);

This function modifies the state of a shared folder mounted in the virtual machine.

# Parameters

vmHandle
  Identifies a virtual machine. Call VixVM_Open() to create a virtual machine handle.
shareName
  Specifies the name of the shared folder.
hostPathName
  Specifies the host path of the shared folder.
flags
  The new flag settings.
callbackProc
  A callback function that will be invoked when the operation is complete.
clientData
  A parameter that will be passed to the callbackProc function.

# Return Value

VixHandle. A job handle that describes the state of this asynchronous operation.

# Remarks

- This function modifies the state flags of an existing shared folder.
- If the shared folder specified by shareName does not exist before calling this function, the job handle for this function will return VIX_E_NOT_FOUND.
- It is not necessary to call VixVM_LoginInGuest() before calling this function.
- Shared folders are not supported for the following guest operating systems: Windows ME, Windows 98, Windows 95, Windows 3.x, and DOS.
- In this release, this function requires the virtual machine to be powered on with VMware Tools installed.

# Side Effects

None.

# Requirements

vix.h, since VMware Workstation 6.0

# Example

    VixHandle jobHandle;
    VixError err;
    int numSharedFolders;
    char *folderName;
    char *folderHostPath;
    int folderFlags;
    int i;

    jobHandle = VixVM_GetNumSharedFolders(vmHandle, NULL, NULL);
    err = VixJob_Wait(jobHandle, VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_COUNT,
    		  &numSharedFolders, VIX_PROPERTY_NONE);
    Vix_ReleaseHandle(jobHandle);
    if (VIX_OK != err) {
       // handle error
    }

    for (i = 0; i < numSharedFolders; i++) {
       jobHandle = VixVM_GetSharedFolderState(vmHandle, i, NULL, NULL);
       err = VixJob_Wait(jobHandle,
                         VIX_PROPERTY_JOB_RESULT_ITEM_NAME, &folderName,
                         VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_HOST,
    &folderHostPath,
                         VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_FLAGS, &folderFlags,
    		     VIX_PROPERTY_NONE);
       Vix_ReleaseHandle(jobHandle);
       if (VIX_OK != err) {
          // handle error
       }

       /*
        * make all folders writable
        */
       jobHandle = VixVM_SetSharedFolderState(vmHandle, folderName, folderHostPath,
                                              VIX_SHAREDFOLDER_WRITE_ACCESS,
                                              NULL, NULL);
       err = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);
       Vix_ReleaseHandle(jobHandle);
       if (VIX_OK != err) {
          // handle error
       }
       Vix_FreeBuffer(folderName);
       Vix_FreeBuffer(folderHostPath);
    }

Copyright (C) 2007-2018 VMware, Inc. All rights reserved.