Bug BSOD KB5000802 - correggi le stampanti

Domande sul packaging WAPT / Richieste e assistenza sui pacchetti Wapt.
Regole del forum
Regole del forum della community
* Supporto in inglese su www.reddit.com/r/wapt
* Supporto della community in francese disponibile su questo forum
* Si prega di anteporre [RISOLTO] al titolo dell'argomento se è stato risolto.
* Si prega di non modificare un argomento contrassegnato con [RISOLTO]. Aprire un nuovo argomento facendo riferimento a quello precedente.
* Specificare la versione di WAPT installata, la versione completa e il numero di build (2.2.1.11957 / 2.2.2.12337 / ecc.) nonché l'edizione Enterprise/Discovery.
* Le versioni 1.8.2 e precedenti non sono più supportate. Le uniche domande accettate relative alla versione 1.8.2 riguardano l'aggiornamento a una versione supportata (2.1, 2.2, ecc.).
* Specificare il sistema operativo del server (Linux/Windows) e la versione (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specificare il sistema operativo della macchina di amministrazione/creazione dei pacchetti e della macchina con l'agente problematico, se applicabile (Windows 7/10/11/Debian 11/ecc.).
* Evitare di porre più domande quando si apre una discussione, altrimenti potrebbe essere ignorata. Se ci sono più discussioni, aprirle separatamente, preferibilmente una dopo l'altra e non tutte contemporaneamente (ovvero, non intasare il forum).
* Includere frammenti di codice, screenshot e altre immagini direttamente nel post. I link a Pastebin, Bitly e altri siti di terze parti verranno sistematicamente rimossi.
* Come in qualsiasi forum della community, il supporto è fornito volontariamente dai membri. Se si necessita di supporto commerciale, è possibile contattare il reparto vendite di Tranquil IT al numero 02.40.97.57.55
Bloccato
nliaudat
Messaggi: 29
Iscrizioni: 8 agosto 2019 - ore 8:31

15 marzo 2021 - 10:59

Pacchetto wapt per correggere il bug delle stampanti introdotto in KB5000802:
#https://www.windowslatest.com/2021/03/1 ...ch-update/

Codice: Seleziona tutto


##https://www.windowslatest.com/2021/03/13/microsoft-working-on-a-fix-for-windows-10-bsod-march-update/

import ctypes
from ctypes.wintypes import BYTE, DWORD, LPCWSTR

printers = [
    'KX DRIVER for Universal Printing',
    'TASKalfa 4052ci',
    'Kyocera TASKalfa 4052ci KX',
    'Kyocera TASKalfa 3252ci KX',
    'Kyocera TASKalfa 3252ci'
]


def install():
    pass
    

    winspool = ctypes.WinDLL('winspool.drv')  # for EnumPrintersW
    msvcrt = ctypes.cdll.msvcrt  # for malloc, free

    # Parameters: modify as you need. See MSDN for detail.
    PRINTER_ENUM_LOCAL = 2
    Name = None  # ignored for PRINTER_ENUM_LOCAL
    Level = 1  # or 2, 4, 5

    class PRINTER_INFO_1(ctypes.Structure):
        _fields_ = [
            ("Flags", DWORD),
            ("pDescription", LPCWSTR),
            ("pName", LPCWSTR),
            ("pComment", LPCWSTR),
        ]

    # Invoke once with a NULL pointer to get buffer size.
    info = ctypes.POINTER(BYTE)()
    pcbNeeded = DWORD(0)
    pcReturned = DWORD(0)  # the number of PRINTER_INFO_1 structures retrieved
    winspool.EnumPrintersW(PRINTER_ENUM_LOCAL, Name, Level, ctypes.byref(info), 0,
            ctypes.byref(pcbNeeded), ctypes.byref(pcReturned))

    bufsize = pcbNeeded.value
    buffer = msvcrt.malloc(bufsize)
    winspool.EnumPrintersW(PRINTER_ENUM_LOCAL, Name, Level, buffer, bufsize,
            ctypes.byref(pcbNeeded), ctypes.byref(pcReturned))
    info = ctypes.cast(buffer, ctypes.POINTER(PRINTER_INFO_1))
    for i in range(pcReturned.value):
        print info[i].pName, '=>', info[i].pDescription
        if info[i].pName in printers:

        #print('Enable direct print for kyocera')
        #for printer in printers:
            print('    Fix %s' % info[i].pName)
            run_notfatal(r'rundll32 printui.dll,PrintUIEntry /Xs /n "%s" attributes +direct' % info[i].pName)


    msvcrt.free(buffer)




def uninstall():
    pass
    # put here what to do when package is removed from host
    # implicit context variables are WAPT, control, user, params, run

    winspool = ctypes.WinDLL('winspool.drv')  # for EnumPrintersW
    msvcrt = ctypes.cdll.msvcrt  # for malloc, free

    # Parameters: modify as you need. See MSDN for detail.
    PRINTER_ENUM_LOCAL = 2
    Name = None  # ignored for PRINTER_ENUM_LOCAL
    Level = 1  # or 2, 4, 5

    class PRINTER_INFO_1(ctypes.Structure):
        _fields_ = [
            ("Flags", DWORD),
            ("pDescription", LPCWSTR),
            ("pName", LPCWSTR),
            ("pComment", LPCWSTR),
        ]

    # Invoke once with a NULL pointer to get buffer size.
    info = ctypes.POINTER(BYTE)()
    pcbNeeded = DWORD(0)
    pcReturned = DWORD(0)  # the number of PRINTER_INFO_1 structures retrieved
    winspool.EnumPrintersW(PRINTER_ENUM_LOCAL, Name, Level, ctypes.byref(info), 0,
            ctypes.byref(pcbNeeded), ctypes.byref(pcReturned))

    bufsize = pcbNeeded.value
    buffer = msvcrt.malloc(bufsize)
    winspool.EnumPrintersW(PRINTER_ENUM_LOCAL, Name, Level, buffer, bufsize,
            ctypes.byref(pcbNeeded), ctypes.byref(pcReturned))
    info = ctypes.cast(buffer, ctypes.POINTER(PRINTER_INFO_1))
    for i in range(pcReturned.value):
        print info[i].pName, '=>', info[i].pDescription
        if info[i].pName in printers:

        #print('Enable direct print for kyocera')
        #for printer in printers:
            print('    Fix %s' % info[i].pName)
            run_notfatal(r'rundll32 printui.dll,PrintUIEntry /Xs /n "%s" attributes -direct' % info[i].pName)


    msvcrt.free(buffer)
nliaudat
Messaggi: 29
Iscrizioni: 8 agosto 2019 - ore 8:31

16 marzo 2021 - 10:06

Aggiornamento dopo la correzione di MS:

Codice: Seleziona tutto

def install():
print('Install kb5001567')
    #2359302 = WU_S_ALREADY_INSTALLED
    run('wusa.exe windows10.0-kb5001567-x64_e3c7e1cb6fa3857b5b0c8cf487e7e16213b1ea83.msu /quiet /norestart',accept_returncodes=[0,2359302])
    
    
def audit():
    print(run_notfatal(r'wmic qfe list | findstr 5001567'))


    return "OK"
Bloccato