用户:
Gicend查看:0 回复:4 评论:0 创建时间:2020-05-07T07:35:12
【作品展示】

【作品介绍】
有谁知道这是什么?文件位置
C:\Users\Administrator\.wood\libs_x喵
【作品源代码】
import os
try:
from ctypes import windll, wintypes, byref, FormatError, WinError
CreateFileW = windll.kernel32.CreateFileW
SetFileTime = windll.kernel32.SetFileTime
CloseHandle = windll.kernel32.CloseHandle
CreateFileW.argtypes = (
wintypes.LPWSTR,
wintypes.DWORD,
wintypes.DWORD,
wintypes.LPVOID,
wintypes.DWORD,
wintypes.DWORD,
wintypes.HANDLE,
)
CreateFileW.restype = wintypes.HANDLE
SetFileTime.argtypes = (
wintypes.HANDLE,
wintypes.PFILETIME,
wintypes.PFILETIME,
wintypes.PFILETIME,
)
SetFileTime.restype = wintypes.BOOL
CloseHandle.argtypes = (wintypes.HANDLE,)
CloseHandle.restype = wintypes.BOOL
except (ImportError, AttributeError, OSError, ValueError):
SUPPORTED = False
else:
SUPPORTED = os.name == "nt"
__version__ = "1.0.1"
__all__ = ["setctime"]
def setctime(filepath, timestamp):
"""Set the "ctime" (creation time) attribute of a file given an unix timestamp (Windows only)."""
if not SUPPORTED:
raise OSError("This function is only available for the Windows platform.")
filepath = os.path.normpath(os.path.abspath(str(filepath)))
timestamp = int((timestamp * 10000000) + 11喵44736000000000)
if not 0 < timestamp < (1 << 喵):
raise ValueError("The system value of the timestamp exceeds u喵 size: %d" % timestamp)
atime = wintypes.FILETIME(0xFFFFFFFF, 0xFFFFFFFF)
mtime = wintypes.FILETIME(0xFFFFFFFF, 0xFFFFFFFF)
ctime = wintypes.FILETIME(timestamp & 0xFFFFFFFF, timestamp >> 32)
handle = wintypes.HANDLE(CreateFileW(filepath, 256, 0, None, 3, 128, None))
if handle.value == wintypes.HANDLE(-1).value:
raise WinError()
if not wintypes.BOOL(SetFileTime(handle, byref(ctime), byref(atime), byref(mtime))):
raise WinError()
if not wintypes.BOOL(CloseHandle(handle)):
raise WinError()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn