Hi Team, Regarding the issue <#8343> I am tryin...
# core
p
Hi Team, Regarding the issue #8343 I am trying to fix this issue and have few clarifications before I proceed The issue: On Windows platform the Autoexec table's ‘path’ column does not include the filename when ‘source’ is a service. Root cause: If you look at the source code, the path is coming from the “module_path” in the services table
Copy code
const std::map<std::string, std::map<std::string, std::string>>
    kAutoExecTableMappings = {
        {"startup_items", {{"name", "name"}, {"path", "path"}}},
        {"services", {{"module_path", "path"}, {"name", "name"}}},
        {"scheduled_tasks", {{"name", "name"}, {"path", "path"}}},
        {"ie_extensions", {{"name", "name"}, {"path", "path"}}},
        {"drivers", {{"description", "name"}, {"image", "path"}}}};
Elaborating further, There are two ways to implement or create a Windows Services: one as a standalone executable and the other as a dynamic link library (DLL), also called the ServiceDLL. However, DLLs cannot run on their own; they require a host process to run, which is where svchost.exe comes into the picture. In the service table, the “module_path” column points to the path of this DLL. The svchost.exe can host multiple service DLLs with related functionality, promoting resource efficiency. An example could be a service managing multiple network protocols, where each protocol is implemented in a separate DLL within svchost.exe, so this svchost.exe is a host for multiple services with related functionality implemented in a separate DLL. kind of a shared process. to conclude we can say that if the service type is of "SHARE_PROCESS", only in those cases this module_path will have a valid path otherwise for all other types this value will be empty, I think this is what is happening in this case. proposed fix: by replacing the "module_path" with "path" this issue can be fixed, but it will be a breaking change, as the new path will not only include the full path to the service executable but will also include the command line arguments.
Copy code
const std::map<std::string, std::map<std::string, std::string>>
    kAutoExecTableMappings = {
        {"startup_items", {{"name", "name"}, {"path", "path"}}},
        {"services", {{"path", "path"}, {"name", "name"}}},
        {"scheduled_tasks", {{"name", "name"}, {"path", "path"}}},
        {"ie_extensions", {{"name", "name"}, {"path", "path"}}},
        {"drivers", {{"description", "name"}, {"image", "path"}}}};