Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/python/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/python/win32.pyc


[XMc@s'dZddlZddlZddlZyddlZddlZWnek
rYnXddlmZdZ	dZ
dZdZe
edd	Zd
ZdefdYZeZd
ZdZejdZejdZdZdZdefdYZejjZdS(s
Win32 utilities.

See also twisted.python.shortcut.

@var O_BINARY: the 'binary' mode flag on Windows, or 0 on other platforms, so it
    may safely be OR'ed into a mask for os.open.
iN(tplatformiii{itO_BINARYicCsttdtS(s6
    Determine which WindowsError name to export.
    tWindowsError(tgetattrt
exceptionstFakeWindowsError(((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pyt_determineWindowsError"sRcBseZdZRS(s\
    Stand-in for sometimes-builtin exception on platforms for which it
    is missing.
    (t__name__t
__module__t__doc__(((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pyR(scCsHtjsdSd}tjtj|dtj}tj|ddS(sGet the path to the Programs menu.

    Probably will break on non-US Windows.

    @returns: the filesystem location of the common Start Menu->Programs.
    sC:\Windows\Start Menu\Programss@SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell FoldersisCommon Programs(RtisWinNTtwin32apitRegOpenKeyExtwin32contHKEY_LOCAL_MACHINEtKEY_READtRegQueryValueEx(tkeynamet
hShellFolders((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pytgetProgramsMenuPath2scCs8d}tjtj|dtj}tj|ddS(s)Get the path to the Program Files folder.s)SOFTWARE\Microsoft\Windows\CurrentVersionitProgramFilesDir(RRR
RRR(RtcurrentV((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pytgetProgramFilesPathAss(\\*)"s(\\+)\ZcCs`d|ks0d|ks0d|ks0|dkr6dp9d}|tjdtjd||S(sL
    Internal method for quoting a single command-line argument.

    @param s: an unquoted string that you want to quote so that something that
        does cmd.exe-style unquoting will interpret it as a single argument,
        even if it contains spaces.
    @type s: C{str}

    @return: a quoted string.
    @rtype: C{str}
    t s	t"ts\1\1s\1\1\\"(t_cmdLineQuoteRe2tsubt_cmdLineQuoteRe(tstquote((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pytcmdLineQuoteJs<cCs&djg|D]}t|^q
S(s^
    Quote an iterable of command-line arguments for passing to CreateProcess or
    a similar API.  This allows the list passed to C{reactor.spawnProcess} to
    match the child process's C{sys.argv} properly.

    @param arglist: an iterable of C{str}, each unquoted.

    @return: a single string, with the given sequence quoted as necessary.
    R(tjoinR(t	argumentsta((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pytquoteArgumentsYs
t_ErrorFormattercBs5eZdZdZdZeeZdZRS(s7
    Formatter for Windows error messages.

    @ivar winError: A callable which takes one integer error number argument
        and returns an L{exceptions.WindowsError} instance for that error (like
        L{ctypes.WinError}).

    @ivar formatMessage: A callable which takes one integer error number
        argument and returns a C{str} giving the message for that error (like
        L{win32api.FormatMessage}).

    @ivar errorTab: A mapping from integer error numbers to C{str} messages
        which correspond to those erorrs (like L{socket.errorTab}).
    cCs||_||_||_dS(N(twinErrort
formatMessageterrorTab(tselftWinErrort
FormatMessageR'((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pyt__init__us		cCsyddlm}Wntk
r-d}nXyddlm}Wntk
r[d}nXyddlm}Wntk
rd}nX||||S(s
        Get as many of the platform-specific error translation objects as
        possible and return an instance of C{cls} created with them.
        i(R)(R*(R'N(tctypesR)tImportErrortNoneRR*tsocketR'(tclsR)R*R'((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pytfromEnvironmentzs





cCs}|jdk	r |j|dS|jdk	r<|j|S|jdk	rp|jj|}|dk	rp|Sntj|S(s
        Returns the string associated with a Windows error message, such as the
        ones found in socket.error.

        Attempts direct lookup against the win32 API via ctypes and then
        pywin32 if available), then in the error table in the socket module,
        then finally defaulting to C{os.strerror}.

        @param errorcode: the Windows error code
        @type errorcode: C{int}

        @return: The error message string
        @rtype: C{str}
        iN(R%R.R&R'tgettoststrerror(R(t	errorcodetresult((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pytformatErrors
(RRR	R+R1tclassmethodR7(((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pyR$fs
		(R	treRR3RR
R-ttwisted.python.runtimeRtERROR_FILE_NOT_FOUNDtERROR_PATH_NOT_FOUNDtERROR_INVALID_NAMEtERROR_DIRECTORYRRRtOSErrorRRRRtcompileRRRR#tobjectR$R1R7(((s8/usr/lib/python2.7/dist-packages/twisted/python/win32.pyt<module>s2
						
B