CreateRTSystemImage
- Updated2023-02-21
- 6 minute(s) read
int CreateRTSystemImage (char IPAddress[], char outputDirPath[], int options, ProgressCallbackType callback, void *callbackData);
Purpose
Creates an image of the target RT system that you can use for system restoration or cloning. Call ApplyRTSystemImage to apply an image to a target system.
An image is a snapshot of an RT system configuration. By default, an image encompasses the entire C:\ volume. If the system also has a Windows installation, the image is limited to the files directly in C:\ and everything under the C:\NI-RT directory. LabWindows/CVI implements images as a local copy of the relevant files and directories of the target system. This implementation makes it possible to hand-edit an image to add, remove, rename, or replace files or directories in any way you want.
Images are useful for restoring a known, working configuration to a system that has become cluttered or unstable over time. Also, because an image is a complete archive of the files on a system at a given time, saving periodic images can be useful for tracking system state over time for quality assurance. Saving an image also makes it possible to install or restore drivers and software from a host Windows machine that does not have any drivers or NI Measurement & Automation Explorer (MAX) installed.
Using images for cloning can simplify the process of deploying a particular system configuration to multiple production targets. Once you configure and test your development system, you can create an image of that system and apply it to any number of unconfigured, identical systems.
You can specify RTUtilOption_GetSoftwareOnly in the options parameter to create an image that contains only core system files and software/drivers installed by MAX. A software-only image is useful as a clean, baseline configuration that you can use as a common starting point for multiple systems or for purging a system of all extraneous programs, data files, and so on that you have added or created over time.
To prevent other applications from interfering with the image creation process, this function locks the target system with the password kilgoretrout for the duration of the operation. If you locked the system with a different password, LabWindows/CVI restores the password after the operation completes.
Windows This function is supported only on Windows.
Parameters
Input | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||
IPAddress | char [] | The IP address or DNS-resolvable hostname of the system to image. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
outputDirPath | char [] | The directory in which to store the system image. If the path does not exist, the function creates the path. An image is comprised of many files, so National Instruments recommends that you specify a new directory for every distinct image you create.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
options | int | A bit field consisting of 0 or more RTUtilOption flags bitwise OR-ed together. You can specify the following flags:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
callback | ProgressCallbackType | A callback function that receives notification of events that occur on the system. You can pass NULL if you do not want to register a callback. The callback function, type ProgressCallback, takes the following form: int CVICALLBACK CallbackFunc (const char *systemIP, const char *systemMAC, int event, void *eventData1, void *eventData2, void *callbackData); The callback is executed in a separate thread every time a RTUtilEvent occurs on the system. If you are interested only in certain events, your callback must examine the event parameter passed in. The systemIP parameter contains the IP address of the system for which the event occurred. The systemMAC parameter contains the system MAC address. The callback return value is ignored. You do not need to explicitly unregister your callback. The callback stop receiving notifications once the operation for which it was registered has completed. Just before the callback is unregistered, it receives the RTUtilEvent_CallbackUnregistered event to indicate that it is safe to clean up callbackData, if necessary. The following lists RTUtilEvent events and relevant details for each event:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
callbackData | void * | A pointer-width value the library passes to the callback function through the callbackData parameter. You can use the callbackData as an integer value or as a pointer to a data object you want to access in the callback function. This way, you do not have to declare the data object as a global variable. |
Return Value
Name | Type | Description |
status | int | Return value indicating whether the function was successful. Unless otherwise stated, zero indicates successful execution and a negative number indicates that an error occurred. You can call the GetRTUtilErrorString function to obtain a message that describes the error. |
Additional Information
Library: Real-Time Utility Library
Include file: rtutil.h
LabWindows/CVI compatibility: LabWindows/CVI 8.5 and later
Example
Refer to realtime\RTSystemImaging\RTSystemImaging.cws for an example of using the CreateRTSystemImage function.