Re: [python-win32] taskscheduler: how to tick setting "Run task as soon as possible after scheduled start is missed"

2023-01-09 Thread Eryk Sun
On 1/5/23, Joel Moberg wrote: > Maybe I can adjust the flag in the Trigger object but I have no idea what > flags are available. The following loosely adapts Microsoft's time trigger task example, with commented links to get further information. The property that directly addresses your question

Re: [python-win32] Need a value from pywin32

2022-06-22 Thread Eryk Sun
On 6/21/22, Steven Manross wrote: > > class WinStationInformation(ctypes.Structure): > __fields__ = [ > ('ConnectState', ctypes.c_long), > ('WinStationName', ctypes.wintypes.WCHAR), > ('LogonId', ctypes.c_ulong), > ('ConnectTime',

Re: [python-win32] Unable to detect shutdown

2022-03-09 Thread Eryk Sun
On 3/9/22, H.Fujii wrote: > I'm currently developing a console program in Python 3.9. > I want to detect the shutdown of Windows and save the data to a file > safely. > I created a sample program by referring to the following URL. >

Re: [python-win32] Inheriting a command line - or how to efficiently replace Unix' os.execvpe

2021-05-14 Thread Eryk Sun
On 5/13/21, Sebastian M. Ernst wrote: > > ... but I am not managing to specify `parameters` so that I can actually > interact with `ssh`. Am I on the wrong track ... ? It's not clear to me what you need. Do you need to spawn and wait for an interactive ssh session that's driven normally by the

Re: [python-win32] Inheriting a command line - or how to efficiently replace Unix' os.execvpe

2021-05-12 Thread Eryk Sun
On 5/12/21, Sebastian M. Ernst wrote: > > It starts the new process more or less like a child, but does not allow it to > control the command line. Instead, both the Python process and the child > die. The child merely manages to produce a few lines of output before that. First let's go over

Re: [python-win32] Opening existing memory mapped files with pywin32

2021-02-21 Thread Eryk Sun
On 2/21/21, rhyslloyd1 wrote: > > In my head my ideal outcome is being able to map the whole memory mapped > file and not have to specify a size for it incase it changes size however I > don't understand the concept of a memory mapped file so I maybe my very > limited understanding is just

Re: [python-win32] Opening existing memory mapped files with pywin32

2021-02-16 Thread Eryk Sun
On 2/16/21, Tim Roberts wrote: > Eryk Sun wrote: >> >> I'm sorry to say that the only reliable solution is to directly call >> WinAPI OpenFileMappingW() and MapViewOfFile() using a foreign-function >> interface (FFI) package such as ctypes or CFFI. I can write up an

Re: [python-win32] Opening existing memory mapped files with pywin32

2021-02-16 Thread Eryk Sun
On 2/16/21, rhyslloyd1 via python-win32 wrote: > > I am trying to open a memory mapped file using Python. I originally used the > "mmap" module from Python however I had issues with it because I had to use > a fixed size for the file even though my goal was to open an existing file > of which the

Re: [python-win32] DeviceIOControl using IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS fails with 'Incorrect function.'

2021-02-10 Thread Eryk Sun
On 2/9/21, Doug Campbell wrote: > > Again, you expand my knowledge! It seems so obvious now after reading what > you wrote that I would not be able to get volume disk extents for a physical > partition but yet this is what I wanted to do because I was attempting to > find out the partition's

Re: [python-win32] DeviceIOControl using IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS fails with 'Incorrect function.'

2021-02-09 Thread Eryk Sun
On 2/9/21, Doug Campbell wrote: > > win32file.DeviceIoControl(hDevice, > winioctlcon.IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, > None, extents, None) > pywintypes.error: (1, 'DeviceIoControl', 'Incorrect function.') > > I have tried with all three of the disks on my system: \\.\PhysicalDrive0, >

Re: [python-win32] DeviceIOControl calls respond with parameter incorrect

2021-02-09 Thread Eryk Sun
On 2/9/21, Doug Campbell wrote: > > That was exactly what I needed. I will have to read up on the _pack_ > directive to understand it but for now things are running the way they > should be. I'm glad I could help. Normally padding is added between fields of a struct in order to support aligned

Re: [python-win32] DeviceIOControl calls respond with parameter incorrect

2021-02-08 Thread Eryk Sun
On 2/8/21, Doug Campbell wrote: > In my python 2 script, I am trying to connect to the VeraCrypt device driver > to get some information on my mounted volumes. The VeraCrypt repo on GitHub [1] indicates that all structures are defined with #pragma pack(1). In ctypes this is the _pack_ directive.

Re: [python-win32] how to code pywin32 run existing window task scheduler?

2021-01-14 Thread Eryk Sun
On 1/14/21, Tim Roberts wrote: > On Jan 13, 2021, at 8:07 PM, Pongthorn Sangkaphet > >> I have tried already but error >> > That’s 0x80070005, which is ERROR_ACCESS_DENIED. Have you tried running > this from an elevated process? The default security descriptor of a task grants all access to

Re: [python-win32] win32process.CreateProcess: '%1 is not a valid Win32 application.'

2020-12-09 Thread Eryk Sun
On 12/9/20, Niko Pasanen wrote: > > So the problem might be that on the Person C's computer, there is actually > a file called "first" that is creating the error. The reason why I was > using win32process.CreateProcess like this was that I'm actually using > pywinauto, which uses

Re: [python-win32] win32process.CreateProcess: '%1 is not a valid Win32 application.'

2020-12-08 Thread Eryk Sun
On 12/8/20, Niko Pasanen wrote: > > path_to_exe = Path(r"C:\path to some\folder\some.exe") FYI, the constructor of pathlib.Path supports forward slash as the path separator, which avoids the need to use a raw string. A WindowsPath instance uses backslash when converting back to a string. >

Re: [python-win32] Help with PySECURITY_DESCRIPTOR

2020-11-13 Thread Eryk Sun
On 10/27/20, momc...@bojinov.info wrote: > > I m trying to store file's acl along with the backup of the file and then > restore it on the same system Consider using BackupRead() and BackupWrite() from the win32file module. These functions support backup and restore of data streams (default and

Re: [python-win32] Very unimportant bug report.

2020-06-18 Thread Eryk Sun
On 6/18/20, Vernon D. Cole wrote: > I am testing the installation of our newest version 228 of pywin32. > > When attempting to install pywidn32 on the 32-bit version of Python > 3.8 on *Windows 7 *32 bit, I get the following error: "The procedure > entry point ucrtbase.terminate could not be

Re: [python-win32] pure python way to open a file with write deny for others

2020-03-06 Thread Eryk Sun
On 3/6/20, Robin Becker wrote: > > OK I want to read the (small) file completely. The other process may try to > re-write the file while I am reading it. I thought the other process already had the file open for writing, but apparently you just want to deny anyone the right to open the file with

Re: [python-win32] pure python way to open a file with write deny for others

2020-03-05 Thread Eryk Sun
On 3/5/20, Robin Becker wrote: > I want to be able to read a windows file which is being periodically written > by another process. I'm having difficulty reconciling this sentence with the subject line. If you want to open a file for reading that's already open for writing, then the open has to

Re: [python-win32] win32api.FindFiles hangs (was COM registration hangs up: 32 bit Python 3.7 on 64 bit Win 7)

2018-12-19 Thread eryk sun
On 12/19/18, Boylan, Ross wrote: > Eryk, thank you for that very detailed explanation. The directory is on a > network share; is NtQueryDirectoryFile[Ex] still the call that would be made > for it? It's the only system call to scan a directory. It's implemented in the I/O manager by sending an

Re: [python-win32] win32api.FindFiles hangs (was COM registration hangs up: 32 bit Python 3.7 on 64 bit Win 7)

2018-12-19 Thread eryk sun
On 12/18/18, Boylan, Ross wrote: > BTW, I installed Visual Studio and wrote a little C++ program that exercised > FindNextFile. It failed in exactly the same way (returns same filename > forever if on a network drive and search spec has the exact file name), but > only when run from the original

Re: [python-win32] Reg. taking folder ownership

2018-08-28 Thread eryk sun
On Tue, Aug 28, 2018 at 5:03 AM, Goku Balu wrote: >> Eryk wrote: >> This call will succeed even if one or more of the privileges wasn't >> modified. In this case GetLastError() returns ERROR_NOT_ALL_ASSIGNED >> (1300). This will be the case if you try to enable the take-ownership >> and restore

Re: [python-win32] Reg. taking folder ownership

2018-08-27 Thread eryk sun
On Mon, Aug 27, 2018 at 6:23 AM, Goku Balu wrote: > > My use case is this. Folder1 is created by Admin1 and ACL is set by Admin1. > Now Admin2 wants to change the ACL. I think we have two options here > 1) Take folder ownership and the do the changes > 2) Take elevated privileges for Admin2

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: > >

Re: [python-win32] Where is MakeAbsoluteSD?

2018-06-27 Thread eryk sun
On Wed, Jun 27, 2018 at 3:14 PM, Rob Marshall wrote: > > I saw that, my problem is that I'm trying to use > win32security.ConvertSecurityDescriptorToStringSecurityDescriptor() > which is returning a self-relative SDDL and I need one that is > absolute. Is there a flag that I can set and get an

Re: [python-win32] Where is MakeAbsoluteSD?

2018-06-27 Thread eryk sun
On Wed, Jun 27, 2018 at 5:04 AM, Rob Marshall wrote: > > I'm trying to convert a self-relative security descriptor, i.e. the > type that is returned by > win32security.ConvertStringSecurityDescriptorToSecurityDescriptor(), > to an absolute SD but I can't seem to find the MakeAbsoluteSD() >

Re: [python-win32] pywintypes.error: (5, 'RegSetValueEx', 'Access denied')

2018-03-15 Thread eryk sun
On Thu, Mar 15, 2018 at 8:44 AM, Robin Kluth wrote: > > I use Python 2.7 on win10 and pywin32 223. I want to log messqages to the > EventLog: > > dllname = os.path.dirname(__file__) > ntl = NTEventLogHandler("Python Logging Test", dllname=dllname) The Python module should not

Re: [python-win32] playing with scintillacon

2017-12-15 Thread eryk sun
On Fri, Dec 15, 2017 at 9:10 PM, Kurt Eilander wrote: > Ok, I found scintilla.dll in the directory above scintillacon.py, but it > came with pywin32, so it *should* be the correct one. > DLL inspector says it's a 64-bit, which is correct for my os. > > I copy that dll, and

Re: [python-win32] os.remove not deleting a file

2017-11-05 Thread eryk sun
On Tue, Oct 31, 2017 at 1:16 PM, Henk Zevenhuizen wrote: > > Then i get the message: "after", the file is still there and i cannot delete > the through windows explorer (permission denied) > the only way to delete the file is killing python Does Explorer explicitly

Re: [python-win32] CreateDesktop() and displaying a window on it

2017-04-07 Thread eryk sun
On Fri, Apr 7, 2017 at 4:35 PM, Tim Roberts wrote: > I see Eryk provided the explanation, but all I had to do to make your > example work was add > hDesk.SetThreadDesktop() > just after your SwitchDesktop call. That didn't work for me before. It was causing my Windows 10

Re: [python-win32] CreateDesktop() and displaying a window on it

2017-04-06 Thread eryk sun
On Thu, Apr 6, 2017 at 7:38 PM, Kurt Eilander wrote: > Hey all, > > I'm trying to get system modal functionality like the UAC dialog. > > According to http://developex.com/blog/system-modal-back/ the thing to do is > to create and switch to a new desktop. > > Therefore,

Re: [python-win32] win32api handle incompatible with ctypes?

2017-03-04 Thread eryk sun
On Sun, Mar 5, 2017 at 12:16 AM, Kurt Eilander wrote: > > I'm having another problem. I'm wanting to get the size of a dll resource, > but... > > When I do: > try: > hLib=win32api.GetModuleHandle(fileName) > except: >

Re: [python-win32] How can I restrict users from changing ACE?

2016-10-06 Thread eryk sun
On Thu, Oct 6, 2016 at 11:36 AM, Francoi Xavier wrote: > I've just started learning about windows ACL and file permissions. The task > here is to make a file/folder read-only and should get deleted/modified only > through our client software. I've denied Write, Delete and

Re: [python-win32] python-win32 Digest, Vol 162, Issue 4

2016-09-23 Thread eryk sun
On Fri, Sep 23, 2016 at 2:12 PM, eryk sun <eryk...@gmail.com> wrote: > Each kernel object type has a GENERIC_MAPPING that maps generic rights > to sets of standard and object-specific rights. Before doing an > AccessCheck, generic rights have to be mapped to specific rights via &

Re: [python-win32] python-win32 Digest, Vol 162, Issue 4

2016-09-23 Thread eryk sun
On Fri, Sep 23, 2016 at 10:39 AM, Goku Balu wrote: > On Tue, Sep 20, 2016 at 9:30 PM, wrote: >> > >> > That doesn't seem like a bug to me. GENERIC_WRITE represents several >> > permissions mashed together, including FILE_WRITE and read

Re: [python-win32] File access entries are incorrectly set

2016-09-20 Thread eryk sun
On Mon, Sep 19, 2016 at 10:21 PM, Christopher Nilsson wrote: > > That doesn't seem like a bug to me. GENERIC_WRITE represents several > permissions mashed together, including FILE_WRITE and read control. > > Perhaps try with just FILE_WRITE on its own? For a file or directory,

Re: [python-win32] win32com.server failure: Is debugging possible?

2016-08-28 Thread eryk sun
On Mon, Aug 29, 2016 at 12:08 AM, Bob Hood wrote: > Breaking on that function produced the following stack trace: I'm glad you found the culprit, but actually the "ModLoad" lines are just printed by the debugger as DLLs are loaded. The stac[k] trace [1] attempts to walk the

Re: [python-win32] win32com.server failure: Is debugging possible?

2016-08-27 Thread eryk sun
On Sat, Aug 27, 2016 at 2:19 PM, Bob Hood wrote: > > From what I can tell, it's not actually a crash. It appears to be an exit() > with a result of 1, so it's not going to be easy to track down. Break on ntdll!RtlExitUserProcess to print a stack trace.

Re: [python-win32] win32com.server failure: Is debugging possible?

2016-08-25 Thread eryk sun
On Fri, Aug 26, 2016 at 12:42 AM, Bob Hood wrote: > Any suggestions as to how I could determine the cause of the crash without > having to uninstall ALL of my software? Configure a postmortem debugger [1] (e.g. windbg -I). Use gflags to temporarily enable full page-heap

Re: [python-win32] Problem registering COM server at installation time

2016-02-01 Thread eryk sun
On Sun, Jan 31, 2016 at 10:42 PM, Mark Hammond wrote: > On 17/01/2016 6:51 AM, Malte Forkel wrote: >> >> I'm trying the register a COM server using the install script of a built >> distribution, created with the bdist_wininst format of distutils. But >> the script fails

[python-win32] python-win32 is for Python on Windows

2015-12-26 Thread eryk sun
On Sat, Dec 26, 2015 at 10:44 AM, Vernon D. Cole wrote: > > 1) this (Python-win32) is not a group for the discussion of Python (in > general) on Windows platforms. It is for discussion of a specific toolkit > (pywin32) Actually, that's not right: python-win32 --

Re: [python-win32] drag files with non-ASCII filenames?

2015-12-16 Thread eryk sun
On Tue, Dec 15, 2015 at 2:27 PM, Tim Roberts wrote: > > The Windows console shell is an 8-bit entity. That means you only have > 256 characters available at any given time, similar to they way > non-Unicode strings work in Python 2. The input and screen buffers of the console