If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
life after Windows....
"Mxsmanic" wrote in message ... Keith Willshaw writes: It looks in the registry oh dim one How will the registry tell the OS the purpose of a file being created by an application? Typical entry HKEY_CLASSES_ROOT\.docx Key Name Value Default Word.Document.12 Content Type application/vnd.openxmlformats-officedocument.wordprocessingml.document What about operating systems with no registry? They typically have similar mechanisms, thats how they know to open Word if you double click on a .doc file No wonder you couldnt hold down a job in IT Keith |
#2
|
|||
|
|||
life after Windows....
Keith Willshaw writes:
Typical entry HKEY_CLASSES_ROOT\.docx Key Name Value Default Word.Document.12 Content Type application/vnd.openxmlformats-officedocument.wordprocessingml.document So? The program calls the API with a request to create file c:\data\xyz.abc. How does the OS determine the purpose of this file, and how does it know whether or not the file is being created in the "right" place? |
#3
|
|||
|
|||
life after Windows....
"Mxsmanic" wrote in message ... Keith Willshaw writes: Typical entry HKEY_CLASSES_ROOT\.docx Key Name Value Default Word.Document.12 Content Type application/vnd.openxmlformats-officedocument.wordprocessingml.document So? The program calls the API with a request to create file c:\data\xyz.abc. How does the OS determine the purpose of this file, and how does it know whether or not the file is being created in the "right" place? The OS neither knows nor cares, all that matters is that the action is legal. That is to say the file name is of the right format for the OS and that the location being accessed 1) exists and 2) the calling procedure has the correct access rights. The base tier of the calling program on the other hand should have rules implemented that ensure that the correct extension is appended to the file and that the correct write opertation is carried out, sequential , text , binary etc. If the file location is critical then the rules that govern that should be implemented in the middle tier. If that decision requires human intervention this is passed to the top or presentation tier. This is software design 101 by the way. Keith |
#4
|
|||
|
|||
life after Windows....
Keith Willshaw writes:
The OS neither knows nor cares, all that matters is that the action is legal. Right. Which makes it possible for applications to misuse even the best APIs. QED. |
#5
|
|||
|
|||
life after Windows....
"Mxsmanic" wrote in message ... Keith Willshaw writes: The OS neither knows nor cares, all that matters is that the action is legal. Right. Which makes it possible for applications to misuse even the best APIs. QED. The question you put was If a program creates a file, how does the API check to see that the file's name is correct? Now API's are NOT only implemented at the OS level but I dont expect a tour guide to know that. In the context of the OS API the posit that the name is 'correct' simply means legal etc. As an example the Windows WriteFile Api takes the following arguments BOOL WriteFile( HANDLE hFile, // handle to file to write to LPCVOID lpBuffer, // pointer to data to write to file DWORD nNumberOfBytesToWrite, // number of bytes to write LPDWORD lpNumberOfBytesWritten, // pointer to number of bytes written LPOVERLAPPED lpOverlapped // pointer to structure needed for overlapped I/O );It returns False if the operation fails , because of an illegal name for example. The details of the error may be retrieved by a GetLastError call. On the other hand the API's I call at the application level have much more specific error checking. If I attempt to open a jpeg filewith an API it reads the file header to check its a valid format. Keith |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
life after Windows....Users have until 14 April 2014 to migratefrom Windows XP. | Shawn The Sheep | Air travel | 1 | April 3rd, 2009 03:28 PM |
life after Windows.... | Mxsmanic | Air travel | 56 | March 30th, 2009 12:49 PM |
life after Windows.... | White Spirit[_2_] | Air travel | 7 | March 28th, 2009 08:29 AM |
life after Windows.... | Mxsmanic | Air travel | 0 | March 27th, 2009 05:50 PM |
life after Windows.... | Doug Jewell | Air travel | 0 | March 27th, 2009 09:09 AM |