Answer the question
In order to leave comments, you need to log in
Search in the registry for settings (DEVMODE and others) of a network printer for different versions of Windows
Good time of the day!
In short, where is the default DEVMODE for the network printer in the registry, and where is the local user's copy of the DEVMODE for the network printer? It is also interesting what are the differences in the path to DEVMODE in the registry for XP , Vista and Windows 7.8 .
Further in details:
I took care of searching the structure for network printers in the DEVMODE registry (for local ones and with DEVMODE itself , I already figured it out). In this regard, questions arose:
1. Does Windows copy the DEVMODE settings in the registry for a network printer
to local user in HKEY_CURRENT_USER\Printers\Connections\,,PrintServer,PrinterName ? (I'm asking because I didn't find them there, but maybe I just didn't initiate this copy) or is the network printer 's DEVMODE copied to HKEY_CURRENT_USER\Printers\DevModes2\PrinterName ?
On Windows 7, the default DEVMODE settings for a network printer are looked up in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider\S-1-5-21-2499520557-3571156519-1839909518-1144\Printers \Connections\,,PrintServer,PrinterName
where S-1-5-21-2499520557-3571156519-1839909518-1144 is the UserId
related to this 2 questions
1. Is " Client Side Rendering Print Provider " always present in the path, or can this name change depending on the type of connection?
2. Where to look for and how to pull out this UserId S-1-5-21-2499520557-3571156519-1839909518-1144 using c # or from the registry in order to substitute it in this path?
In Windows XP (unfortunately I don’t have it to check) the path to the DEVMODE network printer is different
, this key matches windows 7 HKEY_CURRENT_USER > Printers > Connections
and I did not find this in 7k HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Providers\LanMan Print Services\Servers\Printers
in 7ke key breaks at the level of missing " LanMan Print Services"
p.s. for local printers on all versions of Windows starting from XP DevMode for the current user is stored in HKEY_CURRENT_USER\Printers\DevModePerUser\PrinterName
and if absent, it is pulled out from
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\PrinterName \Default DevMode
but what kind of branch is this HKEY_CURRENT_USER\Printers\DevModes2 ?
In one of the examples I saw that when they change DEVMODE for a network or local printer in this branch they also change, from what I found on the network it is connected with network printers, but what exactly it is not clear.Maybe this is just the branch in which DEVMODE is storednetwork printer for local user?
Please enlighten me or send me a link. I've already rummaged through half of the Internet, I did not find anything sensible on the settings of network printers in the registry.
Thanks
Answer the question
In order to leave comments, you need to log in
Specify what you want to configure in network and local printers?
HKEY_CURRENT_USER\Printers\Devmodes2
This key does not exist until the user makes a change and is allowed to save it.
about SID (UserId) found the answer
public static SecurityIdentifier SID
{
get
{
WindowsIdentity identity = null;
identity = WindowsIdentity.GetCurrent();
return identity.User;
}
What do you think this code should do? And what does he actually do (i.e. what does he not like)?
UPD :
Code errors: g.go('...')
variable name g is not declared, add g=grab.Grab() before this line u = urllib.urlopen(src)
variable name src is not declared.
Other errors: xpath is most likely wrong. Just because you copied it from firebug/firepath does not guarantee that grab will be able to process it. Most likely, the browser and grab see a slightly different page, this is due to the processing of javascript. In addition, I (grab 0.4.13, python 2.7, windows 7) grab complained that the xpath() method is no longer supported (deprecated).
UPD2 :
Working code using grab:
import urllib
import grab
import json
g=grab.Grab()
url='https://vk.com/kostya__wolf?z=photo107790602_343297825%2Falbum107790602_00'
search_string=url[url.find('photo'):url.find('%2F')]
xpath='//a[contains(@href, "%s")]' % search_string
g.go(url)
src=g.doc.select(xpath).attr('onclick')
d = json.loads(src[src.find('{'):src.find('}}')+len('}}')])
src=d['temp']['base']+d['temp']['z_'][0]+'.jpg'
urllib.urlretrieve(src,'bibit.jpg')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question