Usage of Non-Signed INF for Registry and File Operations

Hello All,
We are planning to use a non-signed INF file to perform the following actions:

  • Add registry entries
  • Copy files into:
    • C:\Program Files (for 64-bit components)
    • C:\Program Files (x86) (for 32-bit components)

We are executing the INF installation using the following command, from an elevated command prompt:

LPCWSTR cmd = L"RUNDLL32.EXE";
LPCWSTR parameters = L"SETUPAPI.DLL,InstallHinfSection DefaultInstall.ntamd64 132 C:\Users\admin\source\repos\ConsoleApplication1\x64\Debug\netnvcli_WithProgramFiles.inf";

result = ShellExecuteW(
NULL, // hwnd
L"runas", // "runas" to run as administrator
cmd, // executable to run
parameters, // command-line parameters
NULL, // default directory
SW_HIDE // show the window
);
Request you to share if there are any concerns or recommended precautions while using a non-signed INF for this purpose.

Thank you very much
Aditya

Why don't you just write a simple application to do this? You're already elevated. Also, it's incredibly bad practice to embed full pathnames in an INF. Someday, you'll want to run that on a different computer.

Hello Robert,
Thank you for your response.

Yes, we have tested a simple application that performs operations like DeleteFolder, DeleteFile, CreateDirectory, and CopyFile. However, we observed the following issues even when running the application with elevated privileges:

  • Some application files (especially .dll files) could not be deleted or overwritten.
  • We ensured the file attributes were set to normal and explicitly removed the ReadOnly attribute, yet deletion and replacement failed.
  • We attempted to mark the files for deletion on reboot, but this naturally requires a system restart.

Additionally, we have .sys files (mini-filter drivers) that are loaded into kernel space. Since they are in use by the system, deleting or updating them while running is not possible.

The INF-based approach has proven reliable in this scenario, as it supports:

  • File renaming
  • Copying in-use files
  • Deferred operations requiring restart

This is well-documented under the [INF CopyFiles Directive]

Although we may consider transitioning to an MSI-based (WiX) deployment in the future, the current deployment model is based on INF, and we plan to continue with it for the time being due to its compatibility with our installation scenarios.

Please share if we missed anything. Also, we are going to create the full path at runtime dynamically. I have just shared an example.
Request you to share your suggestions. Thank you very much for your help.

Thank you