Method and apparatus for customizing disk serial number in windows system
By developing a disk-level filter driver in the Windows system, intercepting I/O request packets, and customizing the disk serial number, the flexibility and security issues of disk serial number modification in the Windows system are solved. It adapts to serial numbers of different lengths, avoids system crashes, and achieves stable and secure serial number forgery.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING HAIYUDONGXIANG TECH CO LTD
- Filing Date
- 2026-05-07
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies make it difficult to flexibly and securely modify disk serial numbers at the Windows system level, and cannot effectively address situations where different disks have different original serial number lengths, leading to issues such as account restrictions and function lockouts in cloud environments.
By developing a Windows kernel disk class upper-level filter driver, I/O request packets are intercepted, custom disk serial numbers are read, and differential processing is performed according to the original serial number length. The custom serial number is then overwritten or expanded to fill the buffer, and returned to the upper-level application.
It enables the dynamic forgery of arbitrary disk serial numbers at the kernel level to deceive the risk control system, adapts to the original serial number length of different disks, avoids buffer overflow and system crash, and ensures system stability and security.
Smart Images

Figure CN122174290A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cloud computing, and in particular to a method and apparatus for customizing disk serial numbers in a Windows system. Background Technology
[0002] With the popularization and maturity of cloud computing and cloud gaming technologies, more and more users are running applications through these technologies. However, many games or software have built-in risk control systems that identify the operating environment by reading the hardware serial numbers of physical or virtual disks. Because disks in cloud environments often have the same default serial numbers (such as the default serial numbers automatically generated for virtual hard disks by typical VMware virtual machine software) or lack unique identifiers, they are easily identified as virtual machines or abnormal environments by risk control systems, leading to account restrictions, function lockouts, or even service unavailability. Existing technologies struggle to flexibly and securely modify this underlying hardware characteristic at the Windows system level and cannot effectively handle the complex situation where different disks have varying original serial number lengths.
[0003] Therefore, there is an urgent need for a solution that can flexibly and securely modify disk serial numbers at the Windows system level and adapt to handle original serial numbers of different lengths. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method and apparatus for customizing disk serial numbers in a Windows system.
[0005] In a first aspect, embodiments of this application provide a method for customizing disk serial numbers in a Windows system, including: The upper-level filter driver of the disk class intercepts I / O request packets sent to the target disk, determines whether the I / O request packet is a device control request, and whether the control code of the I / O request packet is a storage attribute query request. The target disk has a filter device object created by the upper-level filter driver of the disk class mounted at the top of the device stack. If the I / O request packet is a device control request and the control code is a storage attribute query request, then the custom disk serial number corresponding to the target disk is read from the system registry; Obtain the original serial number length of the target disk. Based on the comparison between the original serial number length and the custom disk serial number length, selectively perform the operation of overwriting the custom disk serial number in the buffer, or perform the operation of expanding the buffer and filling it with the custom disk serial number, and complete the I / O request packet so that the upper-layer application can obtain the custom disk serial number.
[0006] Secondly, embodiments of this application also provide an apparatus for customizing disk serial numbers in a Windows system, comprising: Disk-level upper-layer filter driver, used for: Intercept I / O request packets destined for the target disk, determine whether the I / O request packet is a device control request, and whether the control code of the I / O request packet is a storage attribute query request, wherein the target disk has a filter device object created by the upper layer filter driver of the disk class mounted at the top of the device stack; If the I / O request packet is a device control request and the control code is a storage attribute query request, then the custom disk serial number corresponding to the target disk is read from the system registry; Obtain the original serial number length of the target disk. Based on the comparison between the original serial number length and the custom disk serial number length, selectively perform the operation of overwriting the custom disk serial number in the buffer, or perform the operation of expanding the buffer and filling it with the custom disk serial number, and complete the I / O request packet so that the upper-layer application can obtain the custom disk serial number.
[0007] The method and apparatus for customizing disk serial numbers in a Windows system provided in this application develop a Windows kernel disk class upper-level filter driver and create a filter device object mounted on top of the target disk device stack. This precisely intercepts I / O request packets querying the target disk's storage attributes, reads the custom disk serial number corresponding to the target disk from the registry, and then performs differentiated processing based on the length relationship between the original serial number and the custom disk serial number: either overwriting the custom disk serial number in the buffer or expanding the buffer and filling it with the custom disk serial number. Finally, the custom disk serial number is returned to the upper-level application. This allows for the dynamic forging of arbitrary disk serial numbers at the kernel level to deceive risk control systems, while perfectly adapting to situations where different disks have different original serial number lengths, avoiding buffer overflow and system crash risks. This solves the technical problems in the background art of being unable to flexibly and securely modify underlying hardware characteristics and handling serial number length differences. Attached Figure Description
[0008] Figure 1 A flowchart illustrating an embodiment of a method for customizing disk serial numbers in a Windows system, provided in this application. Figure 2 This is a schematic diagram of an embodiment of a device for customizing disk serial numbers in a Windows system, provided in this application. Detailed Implementation
[0009] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0010] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0011] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0012] Reference Figure 1 The diagram shown is a flowchart illustrating a method for customizing a disk serial number in a Windows system according to an embodiment of this application. The method includes: S10. Intercept I / O request packets sent to the target disk through the upper-layer filter driver of the disk class, determine whether the I / O request packet is a device control request, and whether the control code of the I / O request packet is a storage attribute query request, wherein the target disk has a filter device object created by the upper-layer filter driver of the disk class mounted at the top of the device stack. S11. If the I / O request packet is a device control request and the control code is a storage attribute query request, then read the custom disk serial number corresponding to the target disk from the system registry. S12. Obtain the original serial number length of the target disk. Based on the comparison result between the original serial number length and the custom disk serial number length, selectively perform the operation of overwriting the custom disk serial number in the buffer, or perform the operation of expanding the buffer and filling the custom disk serial number, and complete the I / O request packet so that the upper layer application can obtain the custom disk serial number.
[0013] The method for customizing disk serial numbers in a Windows system provided in this application involves developing a Windows kernel disk class upper-level filter driver and creating a filter device object mounted on top of the target disk device stack. This precisely intercepts I / O request packets querying the target disk's storage attributes, reads the custom disk serial number corresponding to the target disk from the registry, and then performs differentiated processing based on the length relationship between the original serial number and the custom disk serial number: either overwriting the custom disk serial number in the buffer or expanding the buffer and filling it with the custom disk serial number. Finally, the custom disk serial number is returned to the upper-level application. This allows for the dynamic forging of arbitrary disk serial numbers at the kernel level to deceive risk control systems, while perfectly adapting to situations where different disks have different original serial number lengths. It avoids buffer overflow and system crash risks, thus solving the technical problems in the background art of being unable to flexibly and securely modify underlying hardware characteristics and handle serial number length differences.
[0014] The execution process of this invention is described in detail below.
[0015] Step 1: Driver loading and device binding Write a kernel-mode disk class upper-level filter driver conforming to the WDM (Windows Driver Model) specification. This driver is loaded during Windows system startup. When the PnP (Plug and Play) manager enumerates disk devices, the PnP manager calls the driver's callback function to create at least one filter device object and binds it one-to-one to the top of the device stack of at least one disk. After binding, all I / O request packets (IRPs) destined for these disks will first pass through this driver.
[0016] Step 2: IRP Interception and Handling The driver does not process all IRPs, but instead employs a precise interception strategy: it only intercepts device control requests with the control code "Storage Attribute Query Request" (control code value is IOCTL_STORAGE_QUERY_PROPERTY) (device control requests are of type IRP_MJ_DEVICE_CONTROL). This device control request is used to query the attributes of the storage device, which includes disk serial number information. Other IRPs are directly forwarded to the lower-level driver for processing.
[0017] After the driver intercepts the device control request, it reads the custom disk serial number corresponding to the disk in the system registry. The system registry pre-sets an identifier for at least one disk (i.e., the target disk) and its corresponding custom disk serial number. Specifically, the driver reads the custom disk serial number corresponding to the disk identifier from the system registry based on the disk identifier of the device control request. The disk identifier can be a SCSI (Small Computer System Interface) address or a disk ID.
[0018] If the custom disk serial number is not read, it means that the disk corresponding to the device control request is not the target disk whose serial number needs to be modified, and the driver will send the IRP to the lower-level driver for processing. If the custom disk serial number is read, it means that the disk is the target disk. The driver will then obtain the original serial number length of the target disk, compare the original serial number length of the target disk with the custom disk serial number length, and perform the following two differential processing based on the comparison result: (1) When the length of the original serial number is greater than or equal to the length of the custom disk serial number, the custom disk serial number is overwritten in the buffer. In specific implementation, the custom disk serial number can be overwritten starting from the starting address of the original serial number in the buffer. If the length of the original serial number is greater than the length of the custom disk serial number, the extra space needs to be cleared after the overwrite, that is, the remaining data area of the original serial number in the buffer needs to be cleared, and the length field in the returned data structure is updated to the length of the custom disk serial number.
[0019] (2) When the original serial number length is less than the custom disk serial number length or the original serial number length is empty, the buffer is expanded and filled with the custom disk serial number. Specifically, when the upper-layer application queries the properties of the storage device, the system queries the required buffer size. When the system queries the required buffer size, if the driver detects that the value of the required buffer size field (i.e., the requiredSize field) returned by the lower-layer driver (i.e., the lower-layer driver of the kernel-mode disk class upper-layer filter driver) is insufficient to accommodate the custom disk serial number, it will modify the required buffer size field returned by the lower-layer driver. The system will expand the buffer according to the modified required buffer size field. The expanded buffer meets the length of the custom disk serial number. Then, the driver will fill the expanded buffer with the custom disk serial number and update the length field and offset field in the header of the returned data structure to the length of the custom disk serial number and the offset of the custom disk serial number in the expanded buffer, respectively. Among them, the value of the modified RequiredSize field is greater than or equal to the sum of the length of the custom disk serial number and the value of the RequiredSize field returned by the lower-layer driver.
[0020] The driver then completes the I / O request packet, enabling the upper-layer application to obtain the custom disk serial number.
[0021] Using the above method, the disk serial number read by the risk control system is a custom, unique value, rather than the default serial number of the virtualization platform or a serial number lacking unique identification, thus bypassing risk control detection based on hardware serial numbers. Furthermore, because the driver handles both scenarios, it can run stably in different virtualization environments without buffer overflows or system crashes. Additionally, because it uses a standard Windows disk filter driver architecture, it is not dependent on specific hardware manufacturers and has good compatibility.
[0022] Reference Figure 2 The diagram shown is a structural schematic of a device for customizing disk serial numbers in a Windows system according to an embodiment of this application. The device includes: Disk-level upper-layer filter driver 20 is used for: Intercept I / O request packets destined for the target disk, determine whether the I / O request packet is a device control request, and whether the control code of the I / O request packet is a storage attribute query request, wherein the target disk has a filter device object created by the upper layer filter driver of the disk class mounted at the top of the device stack; If the I / O request packet is a device control request and the control code is a storage attribute query request, then the custom disk serial number corresponding to the target disk is read from the system registry; Obtain the original serial number length of the target disk. Based on the comparison between the original serial number length and the custom disk serial number length, selectively perform the operation of overwriting the custom disk serial number in the buffer, or perform the operation of expanding the buffer and filling it with the custom disk serial number, and complete the I / O request packet so that the upper-layer application can obtain the custom disk serial number.
[0023] The device for customizing disk serial numbers in a Windows system provided in this application embodiment is implemented in the same way as the method for customizing disk serial numbers in a Windows system provided in this application embodiment, and the effect it achieves is also the same as the method for customizing disk serial numbers in a Windows system provided in this application embodiment, so it will not be described again here.
[0024] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for customizing disk serial numbers in a Windows system, characterized in that, include: The upper-level filter driver of the disk class intercepts I / O request packets sent to the target disk, determines whether the I / O request packet is a device control request, and whether the control code of the I / O request packet is a storage attribute query request. The target disk has a filter device object created by the upper-level filter driver of the disk class mounted at the top of the device stack. If the I / O request packet is a device control request and the control code is a storage attribute query request, then the custom disk serial number corresponding to the target disk is read from the system registry; Obtain the original serial number length of the target disk. Based on the comparison between the original serial number length and the custom disk serial number length, selectively perform the operation of overwriting the custom disk serial number in the buffer, or perform the operation of expanding the buffer and filling it with the custom disk serial number, and complete the I / O request packet so that the upper-layer application can obtain the custom disk serial number.
2. The method as described in claim 1, characterized in that, The selective execution of the operation of overwriting the custom disk serial number in the buffer, or the operation of expanding the buffer and filling it with the custom disk serial number, includes: If the length of the original serial number is greater than or equal to the length of the custom disk serial number, then the custom disk serial number is directly overwritten and written into the output buffer; or If the length of the original serial number is less than the length of the custom disk serial number, or if the length of the original serial number is empty, then when the system queries the required buffer size, the required buffer size field returned by the underlying driver is modified to expand the buffer. After the system allocates a buffer that meets the length of the custom disk serial number, the custom disk serial number is filled in.
3. The method as described in claim 2, characterized in that, The step of directly overwriting the custom disk serial number in the output buffer includes: The custom disk serial number is directly overwritten in the output buffer, and any excess space is cleared.
4. The method as described in claim 2, characterized in that, Modifying the required buffer size field returned by the underlying driver to expand the buffer includes: Modify the value of the required buffer size field returned by the underlying driver to be greater than or equal to the sum of the custom disk serial number length and the value of the required buffer size field returned by the underlying driver.
5. A device for customizing disk serial numbers in a Windows system, characterized in that, include: Disk-level upper-layer filter driver, used for: Intercept I / O request packets destined for the target disk, determine whether the I / O request packet is a device control request, and whether the control code of the I / O request packet is a storage attribute query request, wherein the target disk has a filter device object created by the upper layer filter driver of the disk class mounted at the top of the device stack; If the I / O request packet is a device control request and the control code is a storage attribute query request, then the custom disk serial number corresponding to the target disk is read from the system registry; Obtain the original serial number length of the target disk. Based on the comparison between the original serial number length and the custom disk serial number length, selectively perform the operation of overwriting the custom disk serial number in the buffer, or perform the operation of expanding the buffer and filling it with the custom disk serial number, and complete the I / O request packet so that the upper-layer application can obtain the custom disk serial number.