
there is instant drama when the subject of a drawing is a person looking away. sometimes paintings have this about them. its more than what it is seen, but what is unseen.
d'abord, j'ai fait des exercises de français. tu peux lire, étudier, ou corriger ce que j'ai fait ici -->
page 80 imparfait. hier soir, j'ai diné avec toi et je ne pouvais pas m'aider de regarder aux tes lèvres jolies (lips). j'ai voulu les baiser. j'ai voulu t'embrasser pendant nous parlions de nos problèmes.
i have been working on this bug for 2 weeks and finally i had a stroke of luck yesterday. luck in this case is coming up with the correct search string to get you to the correct website.
a little introduction. in windows, printing preferences are stored in DEVMODEs. a DEVMODE is a windows structure that contains paper orientation, paper size, number of copies to print, all the things that we see in the printing preferences. there are two types of DEVMODEs. (1) the global DEVMODE contains the preference settings we see when we right click to printing preferences from the printer and faxes folder inside the control panel. (2) and the user DEVMODEs are the preference settings we see from each application. (example. notepad has its own user DEVMODE separate from word's user DEVMODE etc)
to open programmatically either one or the other depends on the calling process. if the calling process is SYSTEM owned the user DEVMODE is accessed. if the calling process is user owned the global DEVMODE s accessed. this seems rather confusing. and it could be a popular source of confusion. this information is based on observation. thanks to bernski who pointed it out to me while we were observing the list of running processes in the task manager.
now back to the bug. i have a program that launches the printing preferences, via ::DocumentProperties(). but since the program is launched by the SYSTEM, the user DEVMODE is accessed. i needed a way for the program to access the global DEVMODE from a SYSTEM owned process. therefore, using ::DocumentProperties() can never work. it is dependent on the caller, as with the rest of the program.
i searched and searched without knowing what exactly i was looking for and found another way to launch printing preference. this time from the command line. however it also suffers the same fate as the API above. when called by the SYSTEM, it accesses the user DEVMODE.
RUNDLL32 PRINTUI.DLL,PrintUIEntry /e /n"Mon imprimante"
/e - to display printing preferences
/n - printer's friendly name
enters CreateProcessAsUser(). this function alone holds one hundred and fifty parameters. kidding. there is no doubt that it is overwhelming. this function will enable me to launch printing preferences from a SYSTEM owned process by putting in another step. to create a user owned process that launches the global printing preferences. here are the steps to use this function.
1. get user's session ID
2. get user token associated with user's session ID
3. make duplicate token (to be used as primary token in CreateProcessAsUser())
4. create an environment block (to be used in CreateProcessAsUser())
5. use CreateProcessAsUser("rundll32 printui.dll ..")
6. close handles and destroy environment block
now sometimes the step to get a user token associated with the user's session ID fails, because it lacks certain user privileges. in this case, we need to impersonate the user.
1. ImpersonateSelf(SecurityImpersonation)
2. get current thread
3. get current thread token associated with current thread
4. ImpersonateLoggedOnUser(current thread token)
5. duplicate current thread token (to be used as primary token in CreateProcessAsUser)
6. create environment block (to be used in CreateProcessAsUser)
7. create process as user
8. destroy environment block