tags:

views:

231

answers:

2

I was under the impression that when you double click a file (or choose 'Open With' from the right click menu), Windows simply calls the application with the filename as the parameter. Something like this:

C:\> App.exe file.abc

However, I just double clicked an .xls file and then checked the PEB of the Excel instance that sprang up. To my surprise the commandline did not contain the filename as a parameter.

So that set me wondering. What exactly is the mechanism Windows uses to have a file opened by a relevant application? Is there a special API that each application that supports such facility must expose?

+6  A: 

How Windows passes the file to the program varies from one application to another. This behavior is controlled by the registry.

In the case of Excel they use what is called DDE for the purpose. That's why you see nothing on the command line.

SLaks
A: 

the filename is not always passed as parameter in actual.

you have with yourself a list of programs associated with some specific file type in ur registry.the system checks for the file extension then starts a process associated with.but always passing it as parameter is not true. The operating system has its own architecture to call a program from its assembly.

peril brain