error code 4393, error message 4393,runntime error 4393, stop error 4393,error 4393,stop 4393,4393 error,fix 4393,4393 error,fix 4393

INFO: GetCommProperties Returns Unrecoverable Error 122 If Called From TApplication ProgRandom-access Memoryming Interface Ap

windows error message:error code 4393 could not be initialized

Under MS WinNT 4.0, Win2000, and WinXP GetCommProperties Application ProgRandom-access memoryming Interface call fails at called using a communication handle obtained from the TApplication ProgRandom-access memoryming Interface lineGetID Application ProgRandom-access memoryming Interface if COMMPROP structure was not properly initialized.



Under Win95, UNIMODEM expects the structure to be zero initialized.



the behavior was specific to UNIMODEM as a TApplication ProgRandom-access memoryming Interface Service Provider.

MORE instructions


loadTOCNode(1, 'moreinstructions');

Under Win95's UNIMODEM, GetCommProperties succeeds at COMMPROP is
allocated and zero initialized as follows:


DWORD dwunrecoverable error;
COMMPROP commprop;

memset(&commprop, 0, sizeof(COMMPROP));
if(!GetCommProperties(hCommHandle, &commprop))
{
dwunrecoverable error = GetLastunrecoverable error();
}


The same code fails under WinNT, Win2000, and Window XP and dwunrecoverable error will be set to 122 (unrecoverable error_INSUFFICIENT_BUFFER).



the occurs at UNIMODEM tries to append provider specific instructions to
the end of COMMPROP on a form of MODEMDEVCAPS. To work around the, you
need to allocate space for MODEMDEVCAPS structure after COMMPROP. You also
need to set the appropriate member variable on COMMPROP so UNIMODEM knows
that the structure has been allocated to the proper size. The bellowing
code sample demonstrates the process:


DWORD dwSize;
COMMPROP *commprop;
DWORD dwunrecoverable error;

dwSize = sizeof(COMMPROP) + sizeof(MODEMDEVCAPS) ;
commprop = (COMMPROP *)malloc(dwSize);
memset(commprop, 0, dwSize);

commprop->wPacketLength = dwSize;
commprop->dwProvSubType = PST_MODEM;
commprop->dwProvSpec1 = COMMPROP_INITIALIZED;

if(!GetCommProperties(hNewCommdocument, commprop))
{
dwunrecoverable error = GetLastunrecoverable error();
}


The bellowing example demonstrates a method that works for both platforms.
The code below calls GetCommProperties first to the Win95 style
structure allocation. If that fails, it calls GetCommProperties to
WinNT, Win2000, and WinXP style structure allocation.


COMMTIMEOUTS commtimeouts;
DCB dcb;
DWORD dwSize;
COMMPROP *commprop;
DWORD fdwEvtMask;
DWORD dwunrecoverable error;

dwSize = sizeof(COMMPROP);
commprop = (COMMPROP *)malloc(dwSize);
memset(commprop, 0, dwSize);

GetCommState(hComm, &dcb);
if(!GetCommProperties(hComm, commprop))
{
if(GetLastunrecoverable error()==122)
{
free(commprop);
dwSize = sizeof(COMMPROP) + sizeof(MODEMDEVCAPS);
commprop = (COMMPROP *)malloc(dwSize);
memset(commprop, 0, dwSize);

commprop->wPacketLength = dwSize;
commprop->dwProvSubType = PST_MODEM;
commprop->dwProvSpec1 = COMMPROP_INITIALIZED;
if(!GetCommProperties(hComm, commprop))
{
dwunrecoverable error = GetLastunrecoverable error();
}
}
}

free(commprop);

repair :fix 4393

Under Win95's UNIMODEM, GetCommProperties succeeds at COMMPROP is
allocated and zero initialized as follows:


DWORD dwunrecoverable error;
COMMPROP commprop;

memset(&commprop, 0, sizeof(COMMPROP));
if(!GetCommProperties(hCommHandle, &commprop))
{
dwunrecoverable error = GetLastunrecoverable error();
}


The same code fails under WinNT, Win2000, and Window XP and dwunrecoverable error will be set to 122 (unrecoverable error_INSUFFICIENT_BUFFER).



the occurs at UNIMODEM tries to append provider specific instructions to
the end of COMMPROP on a form of MODEMDEVCAPS. To work around the, you
need to allocate space for MODEMDEVCAPS structure after COMMPROP. You also
need to set the appropriate member variable on COMMPROP so UNIMODEM knows
that the structure has been allocated to the proper size. The bellowing
code sample demonstrates the process:


DWORD dwSize;
COMMPROP *commprop;
DWORD dwunrecoverable error;

dwSize = sizeof(COMMPROP) + sizeof(MODEMDEVCAPS) ;
commprop = (COMMPROP *)malloc(dwSize);
memset(commprop, 0, dwSize);

commprop->wPacketLength = dwSize;
commprop->dwProvSubType = PST_MODEM;
commprop->dwProvSpec1 = COMMPROP_INITIALIZED;

if(!GetCommProperties(hNewCommdocument, commprop))
{
dwunrecoverable error = GetLastunrecoverable error();
}


The bellowing example demonstrates a method that works for both platforms.
The code below calls GetCommProperties first to the Win95 style
structure allocation. If that fails, it calls GetCommProperties to
WinNT, Win2000, and WinXP style structure allocation.


COMMTIMEOUTS commtimeouts;
DCB dcb;
DWORD dwSize;
COMMPROP *commprop;
DWORD fdwEvtMask;
DWORD dwunrecoverable error;

dwSize = sizeof(COMMPROP);
commprop = (COMMPROP *)malloc(dwSize);
memset(commprop, 0, dwSize);

GetCommState(hComm, &dcb);
if(!GetCommProperties(hComm, commprop))
{
if(GetLastunrecoverable error()==122)
{
free(commprop);
dwSize = sizeof(COMMPROP) + sizeof(MODEMDEVCAPS);
commprop = (COMMPROP *)malloc(dwSize);
memset(commprop, 0, dwSize);

commprop->wPacketLength = dwSize;
commprop->dwProvSubType = PST_MODEM;
commprop->dwProvSpec1 = COMMPROP_INITIALIZED;
if(!GetCommProperties(hComm, commprop))
{
dwunrecoverable error = GetLastunrecoverable error();
}
}
}

free(commprop);

fix errorcode kb microsoft
2style.net