我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用win32con.FILE_ATTRIBUTE_NORMAL。
def testComplex(self): clsid = pythoncom.MakeIID("{CD637886-DB8B-4b04-98B5-25731E1495BE}") ctime, atime, wtime = self._getTestTimes() d = dict(cFileName="foo.txt", clsid=clsid, sizel=(1,2), pointl=(3,4), dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL, ftCreationTime=ctime, ftLastAccessTime=atime, ftLastWriteTime=wtime, nFileSize=sys_maxsize + 1) self._testRT(d)
def testUnicode(self): # exercise a bug fixed in build 210 - multiple unicode objects failed. ctime, atime, wtime = self._getTestTimes() d = [dict(cFileName="foo.txt", sizel=(1,2), pointl=(3,4), dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL, ftCreationTime=ctime, ftLastAccessTime=atime, ftLastWriteTime=wtime, nFileSize=sys_maxsize + 1), dict(cFileName="foo2.txt", sizel=(1,2), pointl=(3,4), dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL, ftCreationTime=ctime, ftLastAccessTime=atime, ftLastWriteTime=wtime, nFileSize=sys_maxsize + 1), dict(cFileName=u"foo\xa9.txt", sizel=(1,2), pointl=(3,4), dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL, ftCreationTime=ctime, ftLastAccessTime=atime, ftLastWriteTime=wtime, nFileSize=sys_maxsize + 1), ] s = shell.FILEGROUPDESCRIPTORAsString(d, 1) d2 = shell.StringAsFILEGROUPDESCRIPTOR(s) # clobber 'dwFlags' - they are not expected to be identical for t in d2: del t['dwFlags'] self.assertEqual(d, d2)
def MakeDocumentWritable(self): pretend_ss = 0 # Set to 1 to test this without source safe :-) if not self.scModuleName and not pretend_ss: # No Source Control support. win32ui.SetStatusText("Document is read-only, and no source-control system is configured") win32api.MessageBeep() return 0 # We have source control support - check if the user wants to use it. msg = "Would you like to check this file out?" defButton = win32con.MB_YESNO if self.IsModified(): msg = msg + "\r\n\r\nALL CHANGES IN THE EDITOR WILL BE LOST" defButton = win32con.MB_YESNO if win32ui.MessageBox(msg, None, defButton)!=win32con.IDYES: return 0 if pretend_ss: print "We are only pretending to check it out!" win32api.SetFileAttributes(self.GetPathName(), win32con.FILE_ATTRIBUTE_NORMAL) self.ReloadDocument() return 1 # Now call on the module to do it. if self.scModule is None: try: self.scModule = __import__(self.scModuleName) for part in self.scModuleName.split('.')[1:]: self.scModule = getattr(self.scModule, part) except: traceback.print_exc() print "Error loading source control module." return 0 if self.scModule.CheckoutFile(self.GetPathName()): self.ReloadDocument() return 1 return 0
def MakeDocumentWritable(self): pretend_ss = 0 # Set to 1 to test this without source safe :-) if not self.scModuleName and not pretend_ss: # No Source Control support. win32ui.SetStatusText("Document is read-only, and no source-control system is configured") win32api.MessageBeep() return 0 # We have source control support - check if the user wants to use it. msg = "Would you like to check this file out?" defButton = win32con.MB_YESNO if self.IsModified(): msg = msg + "\r\n\r\nALL CHANGES IN THE EDITOR WILL BE LOST" defButton = win32con.MB_YESNO if win32ui.MessageBox(msg, None, defButton)!=win32con.IDYES: return 0 if pretend_ss: print("We are only pretending to check it out!") win32api.SetFileAttributes(self.GetPathName(), win32con.FILE_ATTRIBUTE_NORMAL) self.ReloadDocument() return 1 # Now call on the module to do it. if self.scModule is None: try: self.scModule = __import__(self.scModuleName) for part in self.scModuleName.split('.')[1:]: self.scModule = getattr(self.scModule, part) except: traceback.print_exc() print("Error loading source control module.") return 0 if self.scModule.CheckoutFile(self.GetPathName()): self.ReloadDocument() return 1 return 0
def testUnicode(self): # exercise a bug fixed in build 210 - multiple unicode objects failed. ctime, atime, wtime = self._getTestTimes() d = [dict(cFileName="foo.txt", sizel=(1,2), pointl=(3,4), dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL, ftCreationTime=ctime, ftLastAccessTime=atime, ftLastWriteTime=wtime, nFileSize=sys_maxsize + 1), dict(cFileName="foo2.txt", sizel=(1,2), pointl=(3,4), dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL, ftCreationTime=ctime, ftLastAccessTime=atime, ftLastWriteTime=wtime, nFileSize=sys_maxsize + 1), dict(cFileName="foo\xa9.txt", sizel=(1,2), pointl=(3,4), dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL, ftCreationTime=ctime, ftLastAccessTime=atime, ftLastWriteTime=wtime, nFileSize=sys_maxsize + 1), ] s = shell.FILEGROUPDESCRIPTORAsString(d, 1) d2 = shell.StringAsFILEGROUPDESCRIPTOR(s) # clobber 'dwFlags' - they are not expected to be identical for t in d2: del t['dwFlags'] self.assertEqual(d, d2)
def unhideFile(file): # Set the file attributes back to their defaults ShiraAttribs = win32con.FILE_ATTRIBUTE_NORMAL try: win32api.SetFileAttributes(file, ShiraAttribs) except: debug("core", "fail set normal permissions on file") # Generates an encoded download and execute stub. The primary Python implant # will download this one. It bootstraps by looking at the PE manifest public key section