Method for migrating Windows system through file copying mode

By traversing and copying files and folders by file and folder, combined with the method of repairing MountedDevices and system boot, the problem of low migration efficiency in the existing technology of Windows system is solved, and efficient migration and normal startup of the system is achieved.

CN119884031APending Publication Date: 2025-04-25成都傲梅科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411992032.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The existing technology cannot efficiently migrate Windows systems to other disks, resulting in slowing down the system and failing to start the application properly.

Method used

By traversing and copying files and folders by file and folder, ensure that all data in the source system is completely migrated to the target partition, and retain attributes and ACL information when copying folders, fix MountedDevices and system boot.

Benefits of technology

It realizes efficient migration of Windows systems, ensures consistent user permissions and file security, avoids startup problems, and is suitable for migration of multiple Windows systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884031A_ABST
    Figure CN119884031A_ABST
Patent Text Reader

Abstract

The invention discloses a method for migrating a Wi-Fi system in a file copying mode. The method comprises the steps that whether a backup system environment is a PE system or not is judged; traversing all files or folders in the source system partition; judging a file name, a file attribute and a file type in the traversal return value; continuing to search the remaining files or folders until all the files or folders are copied; and repairing the MountedDevi cies and repairing system guidance, and completing migration. According to the scheme, all data in the source system are ensured by traversing and copying the files and the folders one by one. When a folder is copied, attributes (such as authority, ownership, an access control list (ACL) and the like) of a source folder are copied to a target folder, so that the user authority and the file security are kept consistent. And the redirected folders are specially processed, so that the original directions of the folders can be kept, and the setting and habits of the user can be kept unchanged after migration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of computer data backup, and in particular is a method for migrating a Windows system by means of file copying. Background Art

[0002] As Windows system is used, with the installation, update and generation of temporary files of various applications, the disk space occupied by the system itself will gradually increase, causing the storage space of the C drive to become increasingly tight. This will not only affect the running speed of the system, but may also cause some applications to fail to start or run normally. In addition, considering the user's demand for system performance, many people hope to migrate the operating system originally installed on the mechanical hard disk to the solid-state drive (SSD) to obtain faster reading and writing speeds and a smoother user experience.

[0003] In the prior art, for example, there is a technical solution described in the patent with publication number CN116414797A: a method for copying system files, which combines multiple types of hard disk interfaces into a hard disk read-write device. The method copies the operating system files to the copy disk based on the established copy. The technical solution can copy the operating system files without limiting the type and size of the copy disk.

[0004] In the prior art, the system is copied by integrating the hard disk interface into a hard disk read-write device. However, in actual applications, the performance of the USB 3.0 interface is affected by other factors (such as host performance, file size, number, etc.), and the Windows system cannot be efficiently migrated to other disks. Summary of the invention

[0005] The purpose of the present invention is to provide a method for migrating a Windows system by copying files, so as to solve the problem that the solution in the prior art proposed in the background art cannot efficiently migrate the Windows system to other disks.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0007] A method for migrating a Windows system by copying files, comprising the following steps:

[0008] Step S1, first determine whether the backup system environment is a PE system; if it is, then there is no need to create a snapshot; if not, then it is necessary to first create a snapshot of the source system partition;

[0009] Step S2, traversing all files or folders in the source system partition;

[0010] Step S3, determine whether the file name in the traversal return value is a special character, if so, skip and jump to step S6; if not, go to step S4;

[0011] Step S4, determine whether the file attribute is a folder; if it is a folder, proceed to step S5; if it is a document, copy the document to the target partition and jump to step S6;

[0012] Step S5, determining whether the folder is a redirected folder. If so, configuring the redirected folder in the target partition so that the redirected folder maintains its original direction; if not, creating the folder in the target partition, setting the file attributes in the source folder to the folder created in the target partition, and obtaining the ownership and ACL information of the source folder and setting them to the newly created folder;

[0013] Step S6, continue searching for remaining files or folders until all files or folders are copied;

[0014] Step S7, repair MountedDevices and repair system boot to complete the migration.

[0015] According to the above technical solution, in step S1, when creating a snapshot of the source system, the snapshot is created through create in the ISn apshotMgr module. After the snapshot is successfully created, the GetSymbolByDriveLetter function in the ISnap shotMgr module is used to obtain the symbolic link of the snapshot.

[0016] According to the above technical solution, in step S2, the Windows API function FindFirstFile is used to search for files starting from the root directory of the source partition.

[0017] According to the above technical solution, in step S3, judging whether the file attribute is a folder is specifically as follows: judging whether it is a folder according to the file attributes in the traversal return value, if the condition dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY is true, it means that the file is a folder, otherwise it is a file.

[0018] According to the above technical solution, in step S5, whether the folder is a redirected folder is determined as follows: if the condition of dwFileAttributes&FILE_ATTRIBUTE_REPARSE_POIN is true, it means that the folder is redirected to other folders; if the condition is false, it is a normal folder.

[0019] According to the above technical solution, in step S5, the configuration of the redirected folder includes creating the same folder, setting folder attributes, obtaining the redirected directory, and setting the redirected directory.

[0020] According to the above technical solution, the same folder is created in the target partition, and the folder attributes are set as follows: windowsAPICreateDirectory is used to create the redirected folder in the target partition, and the value of dwFileAttributes read from the source file is set to the newly created folder using the API function SetFileAttributes.

[0021] According to the above technical solution, obtaining the redirection directory from the source folder is specifically as follows: using the API function CreateFile function to open the handle of the source folder, using the DeviceIoControl function and using the FSCTL_GET_REPARSE_POINT control code to obtain the redirection data in the source folder;

[0022] The data type is determined based on the link type in the redirected data. The determination method is ReparseTag == IO_REPARSE_TAG_MOUNT_POINT. If the condition is true, it means that the obtained data is mount point data, which contains a redirected folder address. Otherwise, there is no such data.

[0023] Furthermore, the data types include IO_REPARSE_TAG_MOUNT_POINT, IO_REPARSE_TAG_GLOBAL_REPARSE, and IO_REPARSE_TAG_CLOUD. The type of IO_REPARSE_TAG_MOUNT_POINT corresponds to the MountPointReparseBuffer structure in the REPARSE_DATA_BUFFER union, and the required redirection folder is in the PathBuffer in the MountPointReparseBuffer structure.

[0024] According to the PathBuffer in the REPARSE_DATA_BUFFER structure, the path contains the path of the redirected folder, and the address of the redirected folder is saved so that it can be set to the newly created folder in the target partition.

[0025] According to the above technical solution, setting a redirection directory for a newly created folder in the target partition is specifically as follows: using the Windows API function CreateFile function to open the handle of the folder created in the target partition, initializing the data of the reparse structure, where ReparseTag is equal to IO_REPARSE_TAG_MOUNT_POINT, and the length of ReparseDataLength is calculated according to the actual length of the redirection directory;

[0026] Next, the union in the REPARSE_DATA_BUFFER structure uses the MountPointReparseBuffer structure. The data in the MountPointReparseBuffer is filled according to the data of the redirected folder obtained. Then, the Windows API function DeviceIoControl function is used and the FSCTL_GET_REPARSE_POINT control code is used to set the reparse data of the folder in the target partition.

[0027] According to the above technical solution, set the ownership and ACL information of the source folder to the newly created folder of the target partition:

[0028] Use the Windows API function GetFileSecurity to obtain the size of the security attributes of the source file or folder, use the HeapAlloc function to allocate a memory space of the obtained size and initialize all the space data to 0, use the Windows API function GetFileSecurity to obtain the security attributes of the source file or folder, and then use the Windows API function SetFileSecurity to set the obtained security attributes to the file or folder in the target partition, and finally release the allocated memory space.

[0029] Compared with the prior art, the present invention has the following beneficial effects:

[0030] The solution of the present invention ensures that all data in the source system, including system files, application files, user data, etc., can be completely migrated to the target partition by traversing and copying files and folders one by one. When copying a folder, the properties of the source folder (such as permissions, ownership, access control list ACL, etc.) will be copied to the target folder to ensure that user permissions and file security remain consistent. Special processing is performed on redirected folders to maintain the original directions of these folders, such as "My Documents", "Desktop", etc., to ensure that the user's settings and habits remain unchanged after migration. By repairing MountedDevices and system boot, it is ensured that the new system can start normally and startup problems caused by migration are avoided. By skipping special character files and flexibly handling different types of files, the user-friendliness of the migration process is enhanced, and the possibility of manual intervention and operation errors by users is reduced. It is suitable for the migration of various Windows systems, whether it is data migration for individual users or migration of systems in an enterprise environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is the main flow chart of system migration in the present invention;

[0032] Figure 2 It is a specific flow chart of system migration in the present invention. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] Embodiment 1

[0035] like Figure 1 As shown, a method for migrating a Windows system by copying files includes the following steps:

[0036] Step S1, first determine whether the backup system environment is a PE system; if it is, then there is no need to create a snapshot; if not, then it is necessary to first create a snapshot of the source system partition;

[0037] Step S2, traversing all files in the source system partition;

[0038] Step S3, determine whether the file name in the traversal return value is a special character, if so, skip and jump to step S6; if not, go to step S4;

[0039] Step S4, determine whether the file attribute is a folder; if it is a folder, proceed to step S5; if it is a file, copy the file to the target partition and jump to step S6;

[0040] Step S5, determining whether the folder is a redirected folder. If so, configuring the redirected folder in the target partition so that the redirected folder maintains its original direction; if not, creating the folder in the target partition, setting the file attributes in the source folder to the folder created in the target partition, and obtaining the ownership and ACL information of the source folder and setting them to the newly created folder;

[0041] Step S6, continue searching for remaining files or folders until all files or folders are copied;

[0042] Step S7, repair MountedDevices and repair system boot to complete the migration.

[0043] The solution of the present invention ensures that all data in the source system, including system files, application files, user data, etc., can be completely migrated to the target partition by traversing and copying files and folders one by one. When copying a folder, the properties of the source folder (such as permissions, ownership, access control list ACL, etc.) will be copied to the target folder to ensure that user permissions and file security remain consistent. Special processing is performed on redirected folders to maintain the original directions of these folders, such as "My Documents", "Desktop", etc., to ensure that the user's settings and habits remain unchanged after migration. By repairing MountedDevices and system boot, it is ensured that the new system can start normally and startup problems caused by migration are avoided. By skipping special character files and flexibly handling different types of files, the user-friendliness of the migration process is enhanced, and the possibility of manual intervention and operation errors by users is reduced. It is suitable for the migration of various Windows systems, whether it is data migration for individual users or migration of systems in an enterprise environment.

[0044] Embodiment 2

[0045] This embodiment provides a specific implementation method.

[0046] Step 1: When migrating in a non-PE system, first take a snapshot of the source system partition. Use the existing module ISnapshotMgr to create the snapshot. Call create in the module to create the snapshot. After the snapshot is successfully created, use the GetSymbolByDriveLetter function in the module to obtain the symbolic link of the snapshot. In PE, skip the snapshot step and use the source path directly.

[0047] Step 2, traverse all files / folders in the source partition. Use the Windows API function FindFirstFile to search for files / folders starting from the source partition and directory. According to the file name in the return value of parameter 2 of the FindFirstFile function, use the _tcsicmp function to compare the file names and skip files with special characters; including ".", "..", "$RECYCLE.BIN" and the "SyetemVolume Information" directory (these files exist in every partition, and they are skipped to increase the traversal speed).

[0048] Furthermore, parameter 2 of the Findfirstfile function is a WIN32_FIND_DATA structure, which is a structure defined by Microsoft and contains some basic information about the file, including the file's attributes, name, date, and other information.

[0049] Furthermore, the file name is a member of the WIN32_FIND_DATA structure, which is consistent with the file name displayed in the Windows file browser.

[0050] Use the FindnextFileAPI function to continue searching for the next file (use FindfirstFile to start traversing each folder, and use FindnextFile to find the remaining files. To traverse all documents in a folder through the API, use the combination of these two APIs).

[0051] If the file name returned in parameter 2 is not the file to be skipped above, the dwFileAttributes file attribute in the parameter 2 structure is used to determine whether it is a folder. The judgment method is dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY. If this condition is true, it means that the file is a folder, otherwise it is a document.

[0052] Specifically, dwFileAttributes is the first parameter in WIN32_FIND_DATA (a structure defined by Microsoft), which is used as a parameter of FindFirstFile or FindNextFile. The types of dwFileAttributes include FILE_ATTRIBUTE_HIDDEN, FILE_ATTRIBUTE_SYSTEM, FILE_ATTRIBUTE_DIRECTORY, FILE_ATTRIBUTE_NORMAL, FILE_ATTRIBUTE_REPARSE_POINT, etc. (all defined by Microsoft), so when you need to determine whether a file is a folder, you can use dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY in the WIN32_FIND_DATA data obtained in FindFirstFile or FindNextFile.

[0053] If it is a folder:

[0054] Step 201, determine whether the folder is a redirected folder. The determination method is dwFileAttributes&FILE_ATTRIBUTE_REPARSE_POINT. If the condition is true, it means that the folder is redirected to other folders. When accessing the folder, the redirected folder is actually accessed. If the condition is false, it means that it is a normal folder.

[0055] If it is a redirected folder, the following condition is true:

[0056] Step 2011, use Windows API CreateDirectory to create the folder in the target partition, and use API function SetFileAttributes to set the value of dwFileAttributes read from the source file to the newly created folder.

[0057] Step 2012, obtain the folder to which this folder is redirected from the source folder: use the API function CreateFile function to open the handle of the source folder, use the DeviceIoControl function and use the FSCTL_GET_REPARSE_POINT control code to obtain the redirection data in the source folder. According to the link type in the redirection data, the judgment method is ReparseTag == IO_REPARSE_TAG_MOUNT_POINT. If the condition is true, it means that the obtained data is mount point data, which contains a redirected folder address, according to the structure of REPARSE_DATA_BUFFER (the redirection folder is stored in the PathBuffer in the MountPointReparseBuffer structure in the REPARSE_DATA_BUFFER structure, where REPARSE_DATA_BUFFER is a structure defined by the user).

[0058] In PathBuffer, the beginning is "\??\C:\xxxx", and only the part after "C:\" is needed. Therefore, when copying, you need to add 4 to the end of PathBuffer in wcscpy_s(path,MAX_PATH,pReparse->MountPointReparseBuffer.PathBuffer+4). The path is the path of the redirected folder, which is needed when setting the folder corresponding to the target partition later.

[0059] Step 2013, save the address of the redirected folder so that it can be set to the newly created folder in the target partition later. Because the source folder is redirected to other folders, when opening the source folder, you actually access the redirected directory. When the target partition needs to create a folder that is the same as the source, it also needs to have this feature. Therefore, you need to set the same redirected directory for the newly created folder, that is, all the features of the folder in the source need to be set to the corresponding folder in the target partition.

[0060] The structure of REPARSE_DATA_BUFFER is as follows:

[0061]

[0062]

[0063] Step 2014, create a redirection directory for the newly created folder in the target partition: use the Windows API function CreateFile function to open the handle of the folder created in the target partition, initialize the data of the reparse structure, where ReparseTag is equal to IO_REPARSE_TAG_MOUNT_POINT, the length of ReparseDataLength is calculated according to the actual length of the redirection directory, and the value of Reserved is fixed to 2. Next, the union in the structure of REPARSE_DATA_BUFFER uses the structure of MountPointReparseBuffer, and the data in MountPointReparseBuffer is filled according to the data of the redirection folder obtained. When filling the PathBuffer under MountPointReparseBuffer, it is necessary to fill "\??\" first and then copy the redirection address saved above to the back. The detailed initialization data is as follows, and then use the Windows API function DeviceIoControl function and use the FSCTL_GET_REPARSE_POINT control code to set the reparse data of the folder in the target partition. Wherein parameter 1 in CreateMountPoint is the folder created in the target partition, and parameter 2 is the redirection folder obtained in the above step 2012.

[0064] Initialization code of REPARSE_DATA_BUFFER structure:

[0065]

[0066]

[0067] Step 2015, set the ownership and ACL information of the source folder to the newly created folder in the target partition: use the Windows API function GetFileSecurity to obtain the size of the security attributes of the source file / folder, where the second parameter needs to contain three pieces of information: OWNER_SECURITY_INFORMATION, GROUP_SECURITY_INFORMATION and DACL_SECURITY_INFORMATION, which are the owner, group and permission information corresponding to the file / folder. The size is returned through the last parameter of the function. Use the HeapAlloc function to allocate a memory space of the obtained size and initialize all the space data to 0. Use the Windows API function GetFileSecurity to obtain the security attributes of the source file / folder, where the second parameter needs to contain the macros corresponding to the owner, group and permissions. Then use the Windows API function SetFileSecurity to set the obtained security attributes to the file / folder in the target partition, where the second parameter also needs to contain the macros corresponding to the owner, group and permissions. Finally, release the newly allocated memory space.

[0068] Step 2016, use the FindNextFile API function to continue searching for the next file / folder.

[0069] Step 202, if the folder is just a common folder:

[0070] Step 2021, using the Windows API function CreateDirectory to create the folder in the target partition, and using the Windows API function SetFileAttributes to set the file attributes dwFileAttributes in the source folder to the folder created in the target partition.

[0071] Step 2022, obtain the ownership and ACL information of the source folder and set it to the newly created folder.

[0072] Step 2023, return to step 2022 to recursively retrieve other files / folders in the current directory.

[0073] Step 3, if it is not a folder: Use the Windows API function copyfile to copy the file from the source directory to the corresponding directory in the target partition.

[0074] Step 301, using the windows API function SetFileAttributes, sets the dwFileAttributes attribute in the source file to the file corresponding to the target partition.

[0075] Step 302, use the FindNextFile API function to continue searching for the next file. Then repeat steps 301 to 302 until the FindNextFile function returns FALSE.

[0076] Step 303, repair MountedDevices under the system file: Use the RegLoadKeyAPI function to mount the SYSTEM registry file in the Windows\System32\config directory under the target partition to the HKEY_LOCAL_MACHINE in the registry. In the mounted registry directory: Computer\HKEY_LOCAL_MACHINE\xxx\MountedDevices (where xxx is the name of the SYSTEM file mounted in the registry), delete all values ​​in MountedDevices. Prepare new binary data. If the disk where the target partition is located is MBR, the data is a 4-byte disk signature + an 8-byte starting position of the target partition. If the disk where the target partition is located is GPT, the data is DMIO:ID: + the GUID of the partition. Then create a value named \DosDevices\C: under MountedDevices. The value data is the value of the above binary data to achieve the purpose of repairing the target partition system DosDevices, thereby avoiding the problem of a black screen or a flashing screen after booting.

[0077] Step 4: Use the existing modules to repair the system boot of the target partition to ensure that the system can boot normally.

[0078] Professional term analysis:

[0079] Redirecting a folder is to point or "redirect" the contents of a folder to another location. When users access a redirected directory, the system automatically directs them to access the contents of the target location rather than the actual path of the redirected directory itself.

[0080] Folder ownership and ACL information: These are two important permission management concepts in the file system, which are mainly used to control the access rights of users and groups to files or folders.

[0081] GPT / MBR: These are two types of disks. The difference lies in the way partitions with the maximum supported disk size are managed.

[0082] Registry: An important database in Microsoft Windows used to store system and application settings.

[0083] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0084] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for migrating a Windows system by copying files, characterized in that: The following steps are involved: Step S1, first determine whether the backup system environment is a PE system; If yes, you do not need to create a snapshot; if not, you need to create a snapshot of the source system partition first; Step S2, traversing all files in the source system partition; Step S3, determine whether the file name in the traversal return value is a special character, if so, skip the file and jump to step S6; if not, go to step S4; Step S4, determining whether the file attribute is a folder; If it is a folder, go to step S5; if it is a document, copy the document to the target partition and jump to step S6; Step S5, determining whether the folder is a redirected folder. If so, configuring the redirected folder in the target partition so that the redirected folder maintains its original direction; if not, creating the folder in the target partition, setting the file attributes in the source folder to the folder created in the target partition, and obtaining the ownership and ACL information of the source folder and setting them to the newly created folder; Step S6, continue searching for remaining files until all files are copied; Step S7, repair MountedDevices and repair system boot to complete the migration.

2. The method for migrating a Windows system by copying files according to claim 1, characterized in that: In step S1, when creating a snapshot of the source system, the snapshot is created through create in the ISnapshotMgr module. After the snapshot is successfully created, the GetSymbolByDriveLetter function in the ISnapshotMgr module is used to obtain the symbolic link of the snapshot.

3. The method for migrating a Windows system by copying files according to claim 2, characterized in that: In step S2, the Windows API function FindFirstFile is used to search for files starting from the root directory of the source partition.

4. The method for migrating a Windows system by copying files according to claim 3, characterized in that: In step S3, whether the file attribute is a folder is determined specifically as follows: whether it is a folder is determined according to the file attributes in the traversal return value. If the condition dwFileAttributes&FILE_ATT RIBUTE_DIRECTORY is true, it means that the file is a folder, otherwise it is a document.

5. The method for migrating a Windows system by copying files according to claim 4, characterized in that: In step S5, whether the folder is a redirected folder is determined as follows: if the condition of dwFileAttributes&FILE_ATTRIBUTE_REPARSE_POIN is true, it means that the folder is redirected to another folder; if the condition is false, it is a normal folder.

6. The method for migrating a Windows system by copying files according to claim 5, characterized in that: In step S5, the configuration of the redirection folder includes creating the same folder, setting folder attributes, obtaining the redirection directory, and setting the redirection directory.

7. The method for migrating a Windows system by copying files according to claim 6, characterized in that: Create the same folder in the target partition and set the folder attributes as follows: Use windowsAPICreateDirectory to create the redirected folder in the target partition, and use the API function SetFileAttributes to set the value of dwFileAttributes read from the source file to the newly created folder.

8. The method for migrating a Windows system by copying files according to claim 7, characterized in that: To obtain the redirection directory from the source folder, use the API function CreateFile to open the handle of the source folder, use the DeviceIoControl function and use the FSCTL_GET_REPARSE_POINT control code to obtain the redirection data in the source folder; The data type is determined based on the link type in the redirected data. The determination method is ReparseTag == IO_REPARSE_TAG_MOUNT_POINT. If the condition is true, it means that the acquired data is mount point data, which contains a redirected folder address. Otherwise, there is no such data. According to the PathBuffer in the REPARSE_DATA_BUFFER structure, the path contains the path of the redirected folder, and the address of the redirected folder is saved so that it can be set to the newly created folder in the target partition.

9. The method for migrating a Windows system by copying files according to claim 8, characterized in that: To set the redirection directory for the newly created folder in the target partition, use the Windows API function CreateFile to open the handle of the folder created in the target partition, initialize the data of the reparse structure, where ReparseTag is equal to IO_REPARSE_TAG_MOUNT_POI NT, and the length of ReparseDataLength is calculated according to the actual length of the redirection directory; Next, the union in the REPARSE_DATA_BUFFER structure uses the MountPointReparse Buffer structure. The data in the MountPointReparseBuffer is filled according to the data of the redirected folder obtained. Then, the Windows API function DeviceIoControl function is used and the FSC TL_GET_REPARSE_POINT control code is used to set the reparse data of the folder in the target partition.

10. The method for migrating a Windows system by copying files according to claim 9, characterized in that: Set the ownership and ACL information of the source folder to the newly created folder on the target partition: Use the Windows API function GetFileSecurity to obtain the size of the source file or folder security attributes, use the HeapAlloc function to allocate a memory space of the obtained size and initialize all space data to 0, use the Windows API function GetFileSecurity to obtain the security attributes of the source file or folder, and then use the Windows API function SetFileSecurity to set the obtained security attributes to the file or folder in the target partition, and finally release the allocated memory space.

Citation Information

Patent Citations

  • System file copying method and device, equipment and medium

    CN116414797A