Open palevi67 opened 6 months ago
¿Any idea?
No idea. Sorry.
Alex
I have traced down the program and found the error was generated in the DriverInfo() function. I changed it to the following, and now StartRawDocument() is working again:
// DriverInfo returns information about printer p driver.
func (p *Printer) DriverInfo() (*DriverInfo, error) {
var needed uint32
err := GetPrinterDriver(p.h, nil, 8, nil, needed, &needed)
if err != syscall.ERROR_INSUFFICIENT_BUFFER {
return nil, err
}
b := make([]byte, needed)
err = GetPrinterDriver(p.h, nil, 8, &b[0], needed, &needed)
if err != nil {
return nil, err
}
di := (*DRIVER_INFO_8)(unsafe.Pointer(&b[0]))
return &DriverInfo{
Attributes: di.PrinterDriverAttributes,
Name: windows.UTF16PtrToString(di.Name),
DriverPath: windows.UTF16PtrToString(di.DriverPath),
Environment: windows.UTF16PtrToString(di.Environment),
}, nil
}
I have traced down the program and found the error was generated in the DriverInfo() function. I changed it to the following, and now StartRawDocument() is working again:
I am glad it works for you.
I still do not understand why it fixes your problem. But I don't use this code myself, so I won't spend time investigating it.
Alex
I'm getting an "The data is invalid" error when calling StartRawDocument ... this was working some weeks ago, so I think it might be caused by some OS upgrade.
¿Any idea?
I'm under W11.