Re: [python-win32] How to get actual FILETIME from PyTime

2018-06-28 Thread Tim Roberts
Rob Marshall wrote:
> Thank-you. I also figured out that if I want the "actual" FILETIME I can do:
>
 get_filetime = lambda i: ((i & 0x),(i - (i & 0x))>>32)
 get_filetime(13174227726000)
> (905689856L, 30673639L)
 low,high = get_filetime(13174227726000)
 (high<<32)+low
> 13174227726000L

A FILETIME is just a 64-bit integer, and you can always pass it to APIs
that way.  The only reason the structure has it in two parts is because
the Microsoft C compilers of the early 1990s did not have a 64-bit type.

Another way to do the unpacking is
    struct.unpack('II',struct.pack('Q',i))
and the reverse:
    struct.unpack('Q','strict.pack('II',low,high)[0]

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Where is MakeAbsoluteSD?

2018-06-28 Thread eryk sun
On Thu, Jun 28, 2018 at 4:49 AM, Rob Marshall  wrote:
> Hi,
>
> At the moment I don't need it at all, but when I use the smbcacls
> utility from Samba on a Linux system and have it print the security
> descriptor as an SDDL it gives me something like:
>
> O:S-1-5-21-3327876616-1579407131-3503203118-500G:S-1-5-21-3327876616-
> 1579407131-3503203118-513D:P(A;;0x001e01ff;;;S-1-5-21-3327876616-
> 1579407131-3503203118-500)(A;;0x00120089;;;S-1-5-21-3327876616-
> 1579407131-3503203118-513)(A;;0x00120089;;;WD
>
> That's what I was hoping to get so that I could print it out.
> Currently it doesn't matter because I can use smbcacls to get what I
> want.

There is no such thing as an absolute format SDDL string. Do you
understand that "absolute" in this case is referring to absolute
pointer addresses for the SD components *in memory*? This is opposed
to the relative offset format that's used when marshaling the
structure to disk or over the wire. The distinction is completely
irrelevant to the SDDL string representation of an SD. The conversion
from SDDL to SD always creates a self-relative format SD. It's also
not relevant within the PyWin32 framework, since a
PySECURITY_DESCRIPTOR is stored in self-relative format and
automatically converts to absolute format whenever that's required.
The boring details are handled for you automatically.
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32