resa = EnumPrintersA(6, svName, 4, structpinfo, neededa, neededa, returneda);
The last two parameters must be pointers to variables, but you are using the values. Also with level = 4, the name field should be NULL. It should be:
resa = EnumPrintersA(6, NULL, 4, structpinfo, neededa, &neededa, &returneda);
Check
EnumPrinters function (Winspool.h) - Win32 apps | Microsoft Docs[
^] carefully.
And you should avoid calling
LocalFree(structpinfo);
before you have allocated any space to it, as that may try to free some random address.