-5

There are many specifications on this page https://msdn.microsoft.com/en-us/library/jj712081.aspx

I'm interested in RPC protocol sequences, such as "RPC over named pipes".In particular, I need to find out if there are any tools like SHGetKnownFolderPath or SHGetFolderPath, to get 32-bit WOW folders (

example: x64 machine - C: \ Program Files (x86) and C: \ Windows \ SysWOW64

x32 machine - C: \ Program Files and C: \ Windows \ system32 )

The RPC command should return the correct 32-bit folder, depending on the system's (64 bit or 32 bit).Is It possible?

ilw
  • 2,499
  • 5
  • 30
  • 54
  • `SHGetKnownFolderPath` with `FOLDERID_ProgramFilesX86` maybe? This question is unclear. What exactly are you trying to do? – zett42 Dec 16 '17 at 16:33
  • Via RPC , I need. – ilw Dec 16 '17 at 16:43
  • RPC is a generic tool, to execute arbitrary code in a remote location. It is unrelated to the code you actually execute. – IInspectable Dec 16 '17 at 21:20
  • And, what do you mean? You said about SHGetKnownFolderPath or SHGetFolderPath? – ilw Dec 16 '17 at 22:04
  • You have 2 problems to solve: `1` Write an application that runs on the target machine and queries the information you need. `2` Communicate with that application through RPC. You know [how to do](https://stackoverflow.com/q/47828315/1889329) the first. Now implement the second. – IInspectable Dec 17 '17 at 10:16
  • I want install application remotely, but i don't know - what location (C: \ Program Files (x86) or C: \ Program Files). Because - i ask this question. – ilw Dec 17 '17 at 10:48
  • To install an application on a remote machine, you have to execute code on that remote machine. If anything, this question merely illustrates, that how you think computers work, and how computers really work, are not the same thing. You need to fix your understanding, before you can approach the problem you are trying to solve. – IInspectable Dec 17 '17 at 12:29
  • 1. I can copy service.exe to smb share; 2. I can execute remotely apllication via https://msdn.microsoft.com/en-us/library/cc245923.aspx ant then https://msdn.microsoft.com/en-us/library/cc245957.aspx :) . YOU need to fix your understanding, not me , man :) I can prove my words. – ilw Dec 17 '17 at 12:33
  • So, in other words: You have to execute code on the remote machine. That's precisely what I said, right? – IInspectable Dec 17 '17 at 12:52
  • Yes, i have execute code code on remote machine, but i want and can do it REMOTELY. This code (in this case RPC Service manager) must execute the exe file. But , before this i must know where exe file must be located properly, before copy one to smb share. And AGAIN - I'm asking this question to find out. – ilw Dec 17 '17 at 12:59
  • A binary passed to the service control manager does not need to reside in any particular location. You simply pass the fully qualified pathname to the binary to the service control manager, and it takes it from there. – IInspectable Dec 17 '17 at 13:24
  • I know (i can specify `c:\stupid_any_folder\for_servicesfiles\service.exe`), but I still want to specify the right (correct) place. Visible to user place (like C: \ Program Files (x86) or C: \ Program Files) depending what bits remote machine have. When you understand me? :) – ilw Dec 17 '17 at 13:29
  • I have tracked that `SHGetFolderPath` checks the following registry keys: https://imgur.com/a/yExVe. Maybe It can simply check them with the help of this: https://msdn.microsoft.com/en-us/library/cc244912.aspx – ilw Dec 17 '17 at 14:15

1 Answers1

1

There isn't a function that will tell you the correct path for the remote system. Remember that the local and remote programs do not need to be running the same bitted-ness. This is a problem for the remote program to solve and if the request needs to take bitted-ness into account that needs to be part of the call at which point it is easy for the server to figure out using SHGetKnownFolderPath.

And honestly this seems like it would be a pretty significant security hole if it were present.

SoronelHaetir
  • 14,104
  • 1
  • 12
  • 23
  • If this is possible through the registry https://msdn.microsoft.com/en-us/library/cc244919.aspx, can and possibly use other commands? – ilw Dec 16 '17 at 16:54
  • 1
    There are no security implications with a hypothetical implementation, that can determine a known folder location in a remote system. What sort of security issues do you have in mind? – IInspectable Dec 16 '17 at 21:09