Glenn Linderman wrote:

I looked at the win32print.cpp file. There were lots of Python-internals stuff there that I don't really follow well. I didn't see anything obviously wrong, but I got to wondering about the code that builds the structure... it puts in UTF-8 text strings (which would be same as ASCII in the cases I'm considering, but what if someone has a non-ASCII printer name, or document file name, or ???). And I'm sure the A version of the Windows API probably is happy with ASCII, but does the 64-bit compilation call the A version of the Windows API or the W version?

32 vs 64 makes no difference here.   SetJobA always expects 8-bit strings, SetJobW always expects 16-bit strings.  SetJob maps to one or the other based on the absence or presence of #define UNICODE.  The routines that convert Python strings to zero-terminated strings will do the right thing.


And would the W version be happy with ASCII? Or would that produce an 1804 error?

If you pass ASCII strings to the W API, it just means the strings are interpreted as garbage.  The name will not be found.  It shouldn't cause 1804.

I went to ReactOS and looked at the source code for SetJob. ERROR_INVALID_DATATYPE is returned for exactly one reason: the pDatatype value is not in the valid list of datatypes for the print processor for this job.  There's no reason for that; your structure says "NT EMF 1.008", which is almost always valid.

This had to work at some point.  All of these things get tested. I just don't know what would have changed.  If I get motivated (I've already spent too much time on this ;), I'll see if I can get your script to fail here.


And then of course, I've no idea what compilation parameters were used, either for your program (which works), or for win32print.cpp (which maybe doesn't).

I built mine for non-Unicode.

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


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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

Reply via email to