How does an OS hand a data file over to a process when a user clicks on an icon?

chrstrbrts

Senior member
Aug 12, 2014
522
3
81
Hello,

Let's say you have an icon displayed on your GUI somewhere.

The icon represents a data file e.g. a text file, mp3, jpeg, etc.

The OS at some point has associated that file with a program.

We see this when the data file's icon is a copy of the program's logo e.g. a pdf file whose icon is a small adobe logo.

Anyway, my question is when you double click on a data file icon, how does the OS hand the data over to the process it just created?

Does it malloc the whole data file into the new process's heap?

Thanks.
 

Squeetard

Senior member
Nov 13, 2004
815
7
76
Nope. The executables have variables, or command line options you can pass to them. So the os passes the name of the file to open when it launches the executable.
 

sm625

Diamond Member
May 6, 2011
8,172
137
106
An icon is just an icon. The file will not actually be opened until it finds the program with which to open it. Then, that program actually opens the file.