else if(((NPPVariable)dw2 == NPPVpluginWindowBool) || ((NPPVariable)dw2 == NPPVpluginTransparentBool))
else if(((NPPVariable)dw2 == NPPVpluginWindowBool) || ((NPPVariable)dw2 == NPPVpluginTransparentBool) || ((NPPVariable)dw2 == NPPVpluginKeepLibraryInMemory))
int formatLogItem(LogItemStruct * plis, LPSTR szOutput, LPSTR szEndOfItem, BOOL bDOSStyle){  int iRet = 0;  static char szTime[128];  static char szString[1024];  static char szEOL[8];  static char szEOI[256];  static char szRet[256];  if(bDOSStyle)  {    strcpy(szEOL, "\r\n");    strcpy(szEOI, szEndOfItem);    strcat(szEOI, "\r\n");  }  else  {    strcpy(szEOL, "\n");    strcpy(szEOI, szEndOfItem);    strcat(szEOI, "\n");  }  szRet[0] = '\0';  szOutput[0] = '\0';  wsprintf(szTime, "Time: %lu %lu (%li)%s",                    plis->dwTimeEnter, plis->dwTimeReturn,                    (long)plis->dwTimeReturn - (long)plis->dwTimeEnter, szEOL);  DWORD dw1 = plis->arg1.dwArg;  DWORD dw2 = plis->arg2.dwArg;  DWORD dw3 = plis->arg3.dwArg;  DWORD dw4 = plis->arg4.dwArg;  DWORD dw5 = plis->arg5.dwArg;  DWORD dw6 = plis->arg6.dwArg;  DWORD dw7 = plis->arg7.dwArg;  char sz1[1024] = {'\0'};  char sz2[1024] = {'\0'};  char sz3[1024] = {'\0'};  char sz4[1024] = {'\0'};  char sz5[1024] = {'\0'};  char sz6[1024] = {'\0'};  switch (plis->action)  {    case action_invalid:      break;    // NPN action    case action_npn_version:      if((plis->arg1.pData != NULL)&&(plis->arg2.pData != NULL)&&(plis->arg3.pData != NULL)&&(plis->arg4.pData != NULL))      {        wsprintf(szRet, "Plugin %i.%i, Netscape %i.%i%s",                  *(int*)plis->arg1.pData, *(int*)plis->arg2.pData,                 *(int*)plis->arg3.pData, *(int*)plis->arg4.pData,szEOL);        wsprintf(szString, "NPN_Version(%#08lx, %#08lx, %#08lx, %#08lx)%s%s", dw1,dw2,dw3,dw4,szEOL,szRet);      }      else        wsprintf(szString, "NPN_Version(%#08lx, %#08lx, %#08lx, %#08lx)%s", dw1,dw2,dw3,dw4,szEOL);      break;    case action_npn_get_url_notify:    {      FormatPCHARArgument(sz2, sizeof(sz2), &plis->arg2);      FormatPCHARArgument(sz3, sizeof(sz3), &plis->arg3);      wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "NPN_GetURLNotify(%#08lx, %s, %s, %#08lx)%s%s", dw1,sz2,sz3,dw4,szEOL,szRet);      break;    }    case action_npn_get_url:    {      FormatPCHARArgument(sz2, sizeof(sz2), &plis->arg2);      FormatPCHARArgument(sz3, sizeof(sz3), &plis->arg3);      wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "NPN_GetURL(%#08lx, %s, %s)%s%s", dw1,sz2,sz3,szEOL,szRet);      break;    }    case action_npn_post_url_notify:    {      FormatPCHARArgument(sz2, sizeof(sz2), &plis->arg2);      FormatPCHARArgument(sz3, sizeof(sz3), &plis->arg3);      FormatPCHARArgument(sz5, sizeof(sz5), &plis->arg5);      FormatBOOLArgument(sz6, sizeof(sz6), &plis->arg6);      wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "NPN_PostURLNotify(%#08lx, %s, %s, %li, %s, %s, %#08lx)%s%s",                dw1,sz2,sz3,(uint32)dw4,sz5,sz6,dw7,szEOL,szRet);      break;    }    case action_npn_post_url:    {      FormatPCHARArgument(sz2, sizeof(sz2), &plis->arg2);      FormatPCHARArgument(sz3, sizeof(sz3), &plis->arg3);      FormatPCHARArgument(sz5, sizeof(sz5), &plis->arg5);      FormatBOOLArgument(sz6, sizeof(sz6), &plis->arg6);      wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "NPN_PostURL(%#08lx, %s, %s, %li, %s, %s)%s%s",                dw1,sz2,sz3,(uint32)dw4,sz5,sz6,szEOL,szRet);      break;    }    case action_npn_new_stream:    {      FormatPCHARArgument(sz2, sizeof(sz2), &plis->arg2);      FormatPCHARArgument(sz3, sizeof(sz3), &plis->arg3);      wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      if(plis->arg4.pData != NULL)        wsprintf(szString, "NPN_NewStream(%#08lx, %s, %s, %#08lx(%#08lx))%s%s",                  dw1, sz2,sz3,dw4,*(DWORD *)plis->arg4.pData,szEOL,szRet);      else        wsprintf(szString, "NPN_NewStream(%#08lx, \"%s\", \"%s\", %#08lx)%s%s", dw1, sz2,sz3,dw4,szEOL,szRet);      break;    }    case action_npn_destroy_stream:      wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "NPN_DestroyStream(%#08lx, %#08lx, %s)%s%s", dw1,dw2,FormatNPAPIReason((int)dw3),szEOL,szRet);      break;    case action_npn_request_read:      wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "NPN_RequestRead(%#08lx, %#08lx)%s%s", dw1, dw2, szEOL, szRet);      break;    case action_npn_write:    {      FormatPCHARArgument(sz4, sizeof(sz4), &plis->arg4);      wsprintf(szRet, "Returns: %li%s", plis->dwReturnValue,szEOL);      wsprintf(szString, "NPN_Write(%#08lx, %#08lx, %li, %s)%s%s", dw1, dw2, (int32)dw3, sz4, szEOL, szRet);      break;    }    case action_npn_status:    {      FormatPCHARArgument(sz2, sizeof(sz2), &plis->arg2);      wsprintf(szString, "NPN_Status(%#08lx, %s)%s", dw1, sz2, szEOL);      break;    }    case action_npn_user_agent:      wsprintf(szRet, "Returns: %#08lx(\"%s\")%s", plis->dwReturnValue, (LPSTR)plis->dwReturnValue,szEOL);      wsprintf(szString, "NPN_UserAgent(%#08lx)%s%s", dw1, szEOL, szRet);      break;    case action_npn_mem_alloc:      wsprintf(szRet, "Returns: %#08lx%s", plis->dwReturnValue, szEOL);      wsprintf(szString, "NPN_MemAlloc(%li)%s%s", dw1, szEOL, szRet);      break;    case action_npn_mem_free:      wsprintf(szString, "NPN_MemFree(%#08lx)%s", dw1,szEOL);      break;    case action_npn_mem_flush:      wsprintf(szRet, "Returns: %li%s", plis->dwReturnValue,szEOL);      wsprintf(szString, "NPN_MemFlush(%li)%s%s", dw1, szEOL, szRet);      break;    case action_npn_reload_plugins:    {      FormatBOOLArgument(sz1, sizeof(sz1), &plis->arg1);      wsprintf(szString, "NPN_ReloadPlugins(%s)%s", sz1,szEOL);      break;    }    case action_npn_get_java_env:      wsprintf(szRet, "Returns: %#08lx%s", plis->dwReturnValue,szEOL);      wsprintf(szString, "NPN_GetJavaEnv()%s%s", szEOL, szRet);      break;    case action_npn_get_java_peer:      wsprintf(szRet, "Returns: %#08lx%s", plis->dwReturnValue,szEOL);      wsprintf(szString, "NPN_GetJavaPeer(%#08lx)%s%s", dw1, szEOL, szRet);      break;    case action_npn_get_value:    {      wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      switch(dw2)      {        case NPNVxDisplay:        case NPNVxtAppContext:        case NPNVnetscapeWindow:          if(dw3 != 0L)            wsprintf(szString, "NPN_GetValue(%#08lx, %s, %#08lx(%#08lx))%s%s",dw1,FormatNPNVariable((NPNVariable)dw2),dw3,*(DWORD *)dw3,szEOL,szRet);          else            wsprintf(szString, "NPN_GetValue(%#08lx, %s, %#08lx)%s%s",dw1,FormatNPNVariable((NPNVariable)dw2),dw3,szEOL,szRet);          break;        case NPNVjavascriptEnabledBool:        case NPNVasdEnabledBool:        case NPNVisOfflineBool:          if(dw3 != 0L)            wsprintf(szString, "NPN_GetValue(%#08lx, %s, %#08lx(%s))%s%s",                     dw1,FormatNPNVariable((NPNVariable)dw2),dw3,                     (((NPBool)*(DWORD *)dw3) == TRUE) ? "TRUE" : "FALSE", szEOL, szRet);          else            wsprintf(szString, "NPN_GetValue(%#08lx, %s, %#08lx)%s%s",dw1,FormatNPNVariable((NPNVariable)dw2),dw3,szEOL,szRet);          break;        default:          wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);          break;      }      break;    }    case action_npn_set_value:      wsprintf(szRet, "Returns: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      if(((NPPVariable)dw2 == NPPVpluginNameString) || ((NPPVariable)dw2 == NPPVpluginDescriptionString))      {        FormatPCHARArgument(sz3, sizeof(sz3), &plis->arg3);        wsprintf(szString, "NPN_SetValue(%#08lx, %s, %s)%s%s", dw1,FormatNPPVariable((NPPVariable)dw2),sz3,szEOL,szRet);      }      else if(((NPPVariable)dw2 == NPPVpluginWindowBool) || ((NPPVariable)dw2 == NPPVpluginTransparentBool))      {        FormatPBOOLArgument(sz3, sizeof(sz3), &plis->arg3);        wsprintf(szString, "NPN_SetValue(%#08lx, %s, %s)%s%s",                  dw1,FormatNPPVariable((NPPVariable)dw2),sz3,szEOL,szRet);      }      else if((NPPVariable)dw2 == NPPVpluginWindowSize)      {        if(plis->arg3.pData != NULL)        {          int32 iWidth = ((NPSize *)plis->arg3.pData)->width;          int32 iHeight = ((NPSize *)plis->arg3.pData)->height;          wsprintf(szString, "NPN_SetValue(%#08lx, %s, %#08lx(%li,%li))%s%s",                    dw1,FormatNPPVariable((NPPVariable)dw2),dw3,iWidth,iHeight,szEOL,szRet);        }        else          wsprintf(szString, "NPN_SetValue(%#08lx, %s, %#08lx(?,?))%s%s",                    dw1,FormatNPPVariable((NPPVariable)dw2),dw3,szEOL,szRet);      }      else        wsprintf(szString, "NPN_SetValue(%#08lx, %s, %#08lx(What is it?))%s%s", dw1,FormatNPPVariable((NPPVariable)dw2),dw3,szEOL,szRet);      break;    case action_npn_invalidate_rect:    {      if(plis->arg2.pData != NULL)      {        uint16 top    = ((NPRect *)plis->arg2.pData)->top;        uint16 left   = ((NPRect *)plis->arg2.pData)->left;        uint16 bottom = ((NPRect *)plis->arg2.pData)->bottom;        uint16 right  = ((NPRect *)plis->arg2.pData)->right;        wsprintf(szString, "NPN_InvalidateRect(%#08lx, %#08lx(%u,%u;%u,%u)%s", dw1,dw2,top,left,bottom,right,szEOL);      }      else        wsprintf(szString, "NPN_InvalidateRect(%#08lx, %#08lx(?,?,?,?)%s", dw1,dw2,szEOL);      break;    }    case action_npn_invalidate_region:      wsprintf(szString, "NPN_InvalidateRegion(%#08lx, %#08lx)%s", dw1,dw2,szEOL);      break;    case action_npn_force_redraw:      wsprintf(szString, "NPN_ForceRedraw(%#08lx)%s", dw1,szEOL);      break;    // NPP action    case action_np_initialize:      wsprintf(szRet, "Returning: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "Global initialization%s%s", szEOL, szRet);      break;    case action_np_shutdown:      wsprintf(szString, "Global shutdown%s",szEOL);      break;    case action_npp_new:    {      wsprintf(szRet, "Returning: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      char szMode[16];      switch (dw3)      {        case NP_EMBED:          strcpy(szMode, "NP_EMBED");          break;        case NP_FULL:          strcpy(szMode, "NP_FULL");          break;        default:          strcpy(szMode, "[Invalide mode]");          break;      }      wsprintf(szString, "NPP_New(\"%s\", %#08lx, %s, %i, %#08lx, %#08lx, %#08lx)%s%s",                (LPSTR)dw1,dw2,szMode,(int)dw4,dw5,dw6,dw7,szEOL,szRet);      break;    }    case action_npp_destroy:      wsprintf(szRet, "Returning: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "NPP_Destroy(%#08lx, %#08lx(%#08lx))%s%s", dw1, dw2, *(DWORD *)plis->arg2.pData,szEOL,szRet);      break;    case action_npp_set_window:    {      wsprintf(szRet, "Returning: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      char szWindow[512];      if(plis->arg2.pData != NULL)      {        char szType[80];        switch (((NPWindow*)plis->arg2.pData)->type)        {          case NPWindowTypeWindow:            wsprintf(szType, "NPWindowTypeWindow");            break;          case NPWindowTypeDrawable:            wsprintf(szType, "NPWindowTypeDrawable");            break;          default:            wsprintf(szType, "[Unlisted type]");            break;        }        wsprintf(szWindow, "NPWindow: %#08lx, (%li,%li), (%li,%li), (%i,%i,%i,%i), %s",                  ((NPWindow*)plis->arg2.pData)->window,                  ((NPWindow*)plis->arg2.pData)->x,                  ((NPWindow*)plis->arg2.pData)->y,                  ((NPWindow*)plis->arg2.pData)->width,                  ((NPWindow*)plis->arg2.pData)->height,                  ((NPWindow*)plis->arg2.pData)->clipRect.top,                  ((NPWindow*)plis->arg2.pData)->clipRect.left,                  ((NPWindow*)plis->arg2.pData)->clipRect.bottom,                  ((NPWindow*)plis->arg2.pData)->clipRect.right, szType);        wsprintf(szString, "NPP_SetWindow(%#08lx, %#08lx)%s%s%s%s", dw1,dw2,szEOL,szWindow,szEOL,szRet);      }      else        wsprintf(szString, "NPP_SetWindow(%#08lx, %#08lx)%s%s", dw1,dw2,szEOL,szRet);      break;    }    case action_npp_new_stream:    {      switch (*(int16 *)plis->arg5.pData)      {        case NP_NORMAL:          wsprintf(sz5, "NP_NORMAL");          break;        case NP_ASFILEONLY:          wsprintf(sz5, "NP_ASFILEONLY");          break;        case NP_ASFILE:          wsprintf(sz5, "NP_ASFILE");          break;        default:          wsprintf(sz5, "[Unlisted type]");          break;      }      wsprintf(szRet, "Returning: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      FormatPCHARArgument(sz2, sizeof(sz2), &plis->arg2);      wsprintf(szString, "NPP_NewStream(%#08lx, %s, %#08lx, %s, %s)%s%s", dw1, sz2, dw3,                ((NPBool)dw4 == TRUE) ? "TRUE" : "FALSE", sz5, szEOL, szRet);      break;    }    case action_npp_destroy_stream:      wsprintf(szRet, "Returning: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "NPP_DestroyStream(%#08lx, %#08lx, %s)%s%s", dw1,dw2,FormatNPAPIReason((int)dw3),szEOL,szRet);      break;    case action_npp_stream_as_file:      FormatPCHARArgument(sz3, sizeof(sz3), &plis->arg3);      wsprintf(szString, "NPP_StreamAsFile(%#08lx, %#08lx, %s)%s", dw1,dw2,sz3,szEOL);      break;    case action_npp_write_ready:      wsprintf(szRet, "Returning: %li%s", plis->dwReturnValue,szEOL);      wsprintf(szString, "NPP_WriteReady(%#08lx, %#08lx)%s%s", dw1,dw2,szEOL,szRet);      break;    case action_npp_write:    {      wsprintf(szRet, "Returning: %li%s", plis->dwReturnValue,szEOL);      FormatPCHARArgument(sz5, sizeof(sz5), &plis->arg5);      wsprintf(szString, "NPP_Write(%#08lx, %#08lx, %li, %li, %s))%s%s",dw1,dw2,dw3,dw4,sz5,szEOL,szRet);      break;    }    case action_npp_print:      wsprintf(szString, "NPP_Print(%#08lx, %#08lx)%s", dw1, dw2,szEOL);      break;    case action_npp_handle_event:      wsprintf(szRet, "Returning: %i%s", (int16)plis->dwReturnValue,szEOL);      wsprintf(szString, "NPP_HandleEvent(%#08lx, %#08lx)%s%s", dw1,dw2,szEOL,szRet);      break;    case action_npp_url_notify:    {      FormatPCHARArgument(sz2, sizeof(sz2), &plis->arg2);      wsprintf(szString, "NPP_URLNotify(%#08lx, %s, %s, %#08lx)%s", dw1,sz2,FormatNPAPIReason((int)dw3),dw4,szEOL);      break;    }    case action_npp_get_java_class:      wsprintf(szRet, "Returning: %#08lx%s", plis->dwReturnValue,szEOL);      wsprintf(szString, "NPP_GetJavaClass()%s%s",szEOL,szRet);      break;    case action_np_get_mime_description:      wsprintf(szRet, "Returning: %#08lx%s", plis->dwReturnValue,szEOL);      wsprintf(szString, "NPP_GetMIMEDescription()%s%s",szEOL,szRet);      break;    case action_npp_get_value:      wsprintf(szRet, "Returning: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "NPP_GetValue(%#08lx, %s, %#08lx)%s%s", dw1,FormatNPPVariable((NPPVariable)dw2),dw3,szEOL,szRet);      break;    case action_npp_set_value:      wsprintf(szRet, "Returning: %s%s", FormatNPAPIError((int)plis->dwReturnValue),szEOL);      wsprintf(szString, "NPP_SetValue(%#08lx, %s, %#08lx)%s%s", dw1,FormatNPNVariable((NPNVariable)dw2),dw3,szEOL,szRet);      break;    default:      wsprintf(szString, "Unknown action%s",szEOL);      break;  }  strcat(szOutput, szString);  strcat(szOutput, szTime);  strcat(szOutput, szEOI);  iRet = strlen(szString) + strlen(szTime) + strlen(szEOI);  return iRet;}