本文整理汇总了Python中ovd.Platform.System.System.getWindowsVersionName方法的典型用法代码示例。如果您正苦于以下问题:Python System.getWindowsVersionName方法的具体用法?Python System.getWindowsVersionName怎么用?Python System.getWindowsVersionName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ovd.Platform.System.System
的用法示例。
在下文中一共展示了System.getWindowsVersionName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: copySessionStop
# 需要导入模块: from ovd.Platform.System import System [as 别名]
# 或者: from ovd.Platform.System.System import getWindowsVersionName [as 别名]
def copySessionStop(self):
# etre sur que le type est logoff !
d = shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_APPDATA, 0, 0)
profile_tmp_dir = os.path.join(d, "ulteo", "profile", self.session.user.name)
profile_tmp_dir = System.local_encode(profile_tmp_dir)
profile_filter = System.local_encode(Config.profile_filters_filename)
d = os.path.join(self.mountPoint, "conf.Windows.%s"%System.getWindowsVersionName())
trial = 5
while not os.path.exists(d):
try:
os.makedirs(d)
except OSError:
trial -= 1
if trial == 0:
Logger.exception("Failed to create directory %s"%d)
return False
time.sleep(random.randint(1,10)/100.0)
Logger.debug2("conf.Windows mkdir failed (concurrent access because of more than one ApS)")
continue
# Copy user registry
src = os.path.join(self.session.windowsProfileDir, "NTUSER.DAT")
dst = os.path.join(d, "NTUSER.DAT")
if os.path.exists(src):
try:
win32file.CopyFile(src, dst, False)
except:
Logger.error("Unable to copy registry to profile")
else:
Logger.warn("Weird: no NTUSER.DAT in user home dir ...")
# Copy configuration File
if self.profile['profile_mode'] == 'standard':
cmd = self.getRsyncMethod(Profile.toCygPath(profile_tmp_dir), Profile.toCygPath(d), Profile.toCygPath(profile_filter))
Logger.debug("rsync cmd '%s'"%(cmd))
p = System.execute(cmd)
if p.returncode is not 0:
Logger.error("Unable to copy conf to profile")
Logger.debug("Unable to copy conf to profile, cmd '%s' return %d: %s"%(cmd, p.returncode, p.stdout.read()))
if os.path.exists(profile_tmp_dir):
System.DeleteDirectory(profile_tmp_dir)
示例2: copySessionStart
# 需要导入模块: from ovd.Platform.System import System [as 别名]
# 或者: from ovd.Platform.System.System import getWindowsVersionName [as 别名]
def copySessionStart(self):
d = shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_APPDATA, 0, 0)
profile_tmp_dir = os.path.join(d, "ulteo", "profile", self.session.user.name)
profile_tmp_dir = System.local_encode(profile_tmp_dir)
profile_filter = System.local_encode(Config.profile_filters_filename)
for f in [self.DesktopDir, self.DocumentsDir]:
d = os.path.join(self.mountPoint, "Data", f)
trial = 5
while not os.path.exists(d):
try:
os.makedirs(d)
except OSError:
trial -= 1
if trial == 0:
Logger.exception("Failed to create directory %s"%d)
return False
time.sleep(random.randint(1,10)/100.0)
Logger.debug2("Profile mkdir failed (concurrent access because of more than one ApS)")
continue
d = os.path.join(self.mountPoint, "conf.Windows.%s"%System.getWindowsVersionName())
if os.path.exists(d):
# clean temporary file used by windows to load registry
dirs = None
try:
dirs = os.listdir(d)
except Exception:
Logger.exception("Unable to list content of the directory %s"%d)
return
for content in dirs:
if content.startswith(r"NTUSER.DAT.LOG") or content.startswith(r"NTUSER.DAT{"):
try :
path = os.path.join(d, content)
os.remove(path)
except Exception:
Logger.exception("Unable to delete %s"%path)
# Copy user registry
src = os.path.join(d, "NTUSER.DAT")
if os.path.exists(src):
dst = os.path.join(self.session.windowsProfileDir, "NTUSER.DAT")
rand = random.randrange(10000, 50000)
hiveName_src = "OVD_%s_%d"%(str(self.session.id), rand)
win32api.RegLoadKey(win32con.HKEY_USERS, hiveName_src, src)
hiveName_dst = "OVD_%s_%d"%(str(self.session.id), rand+1)
win32api.RegLoadKey(win32con.HKEY_USERS, hiveName_dst, dst)
hkey_src = win32api.RegOpenKey(win32con.HKEY_USERS, r"%s"%(hiveName_src), 0, win32con.KEY_ALL_ACCESS)
hkey_dst = win32api.RegOpenKey(win32con.HKEY_USERS, r"%s"%(hiveName_dst), 0, win32con.KEY_ALL_ACCESS)
Reg.CopyTree(hkey_src, "Software", hkey_dst, self.registry_copy_blacklist)
win32api.RegCloseKey(hkey_src)
win32api.RegCloseKey(hkey_dst)
win32api.RegUnLoadKey(win32con.HKEY_USERS, hiveName_src)
win32api.RegUnLoadKey(win32con.HKEY_USERS, hiveName_dst)
# Copy configuration File
if self.profile['profile_mode'] == 'standard':
cmd = self.getRsyncMethod(Profile.toCygPath(d), Profile.toCygPath(profile_tmp_dir), Profile.toCygPath(profile_filter))
Logger.debug("rsync cmd '%s'"%(cmd))
p = System.execute(cmd)
if p.returncode is not 0:
Logger.error("Unable to copy conf from profile")
Logger.debug("Unable to copy conf from profile, cmd '%s' return %d: %s"%(cmd, p.returncode, p.stdout.read()))
if os.path.exists(profile_tmp_dir):
System.rchown(profile_tmp_dir, self.session.user.name)