Changeset 4394


Ignore:
Timestamp:
Oct 2, 2000, 11:23:05 PM (25 years ago)
Author:
phaller
Message:

.

Location:
trunk
Files:
1 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/include/win/options.h

    r3460 r4394  
    1 /* $Id: options.h,v 1.4 2000-04-29 18:25:03 sandervl Exp $ */
     1/* $Id: options.h,v 1.5 2000-10-02 21:23:05 phaller Exp $ */
    22
    33/*
     
    8585
    8686/* Odin profile functions */
    87 
     87/* Odin profile name in KERNEL32.DLL directory */
     88#define ODINININAME "ODIN.INI"
    8889#define ODINCOLORS        "COLORS"
    8990#define ODINDIRECTORIES   "DEVDIRECTORIES"
    9091#define ODINCUSTOMIZATION "CUSTOMIZATION"
    9192
    92 int WINAPI PROFILE_GetOdinIniString(LPCSTR section,LPCSTR key_name,LPCSTR def,LPCSTR buffer,int len);
     93int WINAPI PROFILE_GetOdinIniString(LPCSTR section,LPCSTR key_name,LPCSTR def,LPSTR buffer,UINT len);
    9394int WINAPI PROFILE_SetOdinIniString(LPCSTR section,LPCSTR key_name,LPCSTR value);
    9495int WINAPI PROFILE_GetOdinIniInt(LPCSTR section,LPCSTR key_name,int def);
     
    9798int WINAPI PROFILE_SetOdinIniBool(LPCSTR section,LPCSTR key_name,int value);
    9899int WINAPI PROFILE_SaveOdinIni(void);
     100int WINAPI PROFILE_LoadOdinIni(void);
     101void WINAPI WriteOutProfiles(void);
     102
     103//INT WINAPI GetPrivateProfileStringA(LPCSTR section, LPCSTR entry,
     104//                                          LPCSTR def_val, LPSTR buffer,
     105//                                          UINT len, LPCSTR filename);
    99106
    100107/* Version functions */
  • TabularUnified trunk/src/wnetap32/netapi32.def

    r4362 r4394  
    1 ; $Id: netapi32.def,v 1.2 2000-10-02 13:03:01 phaller Exp $
     1; $Id: netapi32.def,v 1.3 2000-10-02 21:19:11 phaller Exp $
    22
    33LIBRARY WNETAP32 INITINSTANCE
     
    55
    66IMPORTS
    7     Net32WkstaGetInfo = NETAPI32.146
    8     Net32WkstaSetInfo = NETAPI32.147
     7    Net32StatisticsGet2 = NETAPI32.125
     8    Net32WkstaGetInfo   = NETAPI32.146
     9    Net32WkstaSetInfo   = NETAPI32.147
    910
    1011EXPORTS
  • TabularUnified trunk/src/wnetap32/oslibnet.cpp

    r4373 r4394  
    2828#include <wksta.h>
    2929#include <neterr.h>
     30#include <netstats.h>
    3031
    3132
     
    222223                    unsigned long       * pulTotalAvail)
    223224{
    224   APIRET rc = Net32WkstaGetInfo(pszServer, ulLevel, pbBuffer, ulBuffer, pulTotalAvail);
    225   return error2WinError(rc);
     225  USHORT sel = RestoreOS2FS();
     226 
     227  APIRET rc = error2WinError(Net32WkstaGetInfo(pszServer, ulLevel, pbBuffer, ulBuffer, pulTotalAvail));
     228  SetFS(sel);
     229  return rc;
    226230}
    227231
    228232
     233/*****************************************************************************
     234 * Name      : NET_API_STATUS OSLibNetStatisticsGet
     235 * Purpose   :
     236 * Parameters:
     237 * Variables :
     238 * Result    :
     239 * Remark    :
     240 * Status    : UNTESTED STUB
     241 *
     242 * Author    : Patrick Haller 2000/01/10 01:42
     243 *****************************************************************************/
     244
     245DWORD OSLibNetStatisticsGet(const unsigned char * pszServer,
     246                            const unsigned char * pszService,
     247                            unsigned long         ulReserved,
     248                            unsigned long         ulLevel,
     249                            unsigned long         flOptions,
     250                            unsigned char       * pbBuffer,
     251                            unsigned long         ulBuffer,
     252                            unsigned long       * pulTotalAvail)
     253{
     254  USHORT sel = RestoreOS2FS();
     255  APIRET rc = error2WinError(Net32StatisticsGet2(pszServer,
     256                                  pszService,
     257                                  ulReserved,
     258                                  ulLevel,
     259                                  flOptions,
     260                                  pbBuffer,
     261                                  ulBuffer,
     262                                  pulTotalAvail));
     263  SetFS(sel);
     264  return rc;
     265}
  • TabularUnified trunk/src/wnetap32/oslibnet.h

    r4362 r4394  
    1818                    unsigned long       * pulTotalAvail);
    1919
     20DWORD OSLibNetStatisticsGet(const unsigned char * pszServer,
     21                            const unsigned char * pszService,
     22                            unsigned long         ulReserved,
     23                            unsigned long         ulLevel,
     24                            unsigned long         flOptions,
     25                            unsigned char       * pbBuffer,
     26                            unsigned long         ulBuffer,
     27                            unsigned long       * pulTotalAvail);
     28
    2029#endif
  • TabularUnified trunk/src/wnetap32/wnetap32.cpp

    r4376 r4394  
    1 /* $Id: wnetap32.cpp,v 1.11 2000-10-02 14:04:08 phaller Exp $ */
     1/* $Id: wnetap32.cpp,v 1.12 2000-10-02 21:19:12 phaller Exp $ */
    22
    33/*
     
    3131#include <odin.h>
    3232#include <odinwrap.h>
    33 #include <os2sel.h>
    3433#include <os2win.h>
    3534#include <misc.h>
    3635#include <heapstring.h>
     36#include <string.h>
    3737
    3838#include "oslibnet.h"
    39 #include "lmwksta.h"
     39#include "lanman.h"
    4040
    4141ODINDEBUGCHANNEL(WNETAP32-WNETAP32)
     
    43974397 *****************************************************************************/
    43984398
     4399void UL2LI(PLARGE_INTEGER pli, ULONG ul)
     4400{
     4401  pli->LowPart = ul;
     4402  pli->HighPart = 0;
     4403}
     4404
     4405void LOHI2LI(PLARGE_INTEGER pli, ULONG lo, ULONG hi)
     4406{
     4407  pli->LowPart = lo;
     4408  pli->HighPart = hi;
     4409}
     4410
     4411
    43994412ODINFUNCTION5(NET_API_STATUS,OS2NetStatisticsGet,LPWSTR,  lpServerName,
    44004413                                                 LPWSTR,  lpService,
     
    44034416                                                 LPBYTE*, bufptr)
    44044417{
    4405   dprintf(("NETAPI32: NetUseStatisticsGet not implemented\n"));
    4406 
    4407   return (NERR_BASE);
    4408 }
    4409 
    4410 
     4418  // Note: as we use the static addresses of the strings
     4419  // for a faster comparsion, the compiler may NOT
     4420  // merge duplicate static const strings.
     4421  static LPSTR SERVICE_SERVER       = "SERVER";
     4422  static LPSTR SERVICE_REQUESTER_NT = "REQUESTER";
     4423  static LPSTR SERVICE_REQUESTER_LM = "REQUESTER";
     4424  static LPSTR SERVICE_UNKNOWN      = "UNKNOWN";
     4425 
     4426  // Convert servername to ASCII
     4427  // Convert service name to ASCII AND OS/2-Pendant
     4428  // OS/2 only allowes "SERVER" and "REQUESTER"
     4429  char *asciiServername = NULL;
     4430  if (lpServerName) asciiServername = UnicodeToAsciiString(lpServerName);
     4431 
     4432  // server remains
     4433  LPSTR lpstrOS2Service = NULL;
     4434  if (lpService != NULL)
     4435    if (lstrcmpiW((LPCWSTR)L"WORKSTATION",      (LPCWSTR)lpService) == 0) lpstrOS2Service = (LPSTR)SERVICE_REQUESTER_NT;
     4436    else
     4437    if (lstrcmpW((LPCWSTR)L"LanmanWorkstation", (LPCWSTR)lpService) == 0) lpstrOS2Service = (LPSTR)SERVICE_REQUESTER_LM;
     4438    else
     4439    if (lstrcmpiW((LPCWSTR)L"SERVER",           (LPCWSTR)lpService) == 0) lpstrOS2Service = (LPSTR)SERVICE_SERVER;
     4440    else
     4441    if (lstrcmpW((LPCWSTR)L"LanmanServer",      (LPCWSTR)lpService) == 0) lpstrOS2Service = (LPSTR)SERVICE_SERVER;
     4442    else
     4443    lpstrOS2Service = (LPSTR)SERVICE_UNKNOWN;  // to prevent crashes in NETAPI
     4444 
     4445  // Note: The Win32 docs say nothing about "LanmanWorkstation"
     4446  // Probably this is a request for the LANMAN-Workstation specific data?
     4447#ifdef DEBUG
     4448  {
     4449    char *asciiService = UnicodeToAsciiString(lpService);
     4450    dprintf(("WINMM: NetStatisticsGet server=[%s], service=[%s]\n",
     4451             asciiServername,
     4452             asciiService));
     4453    FreeAsciiString(asciiService);
     4454  }
     4455#endif
     4456 
     4457 
     4458  // @@@PH convert information modes!
     4459  int iOS2Level = dwLevel;     // both must be 0
     4460  int iOS2Options = dwOptions; // seems to be identical
     4461 
     4462  ULONG  ulBytesAvailable;
     4463  DWORD  rc;
     4464 
     4465  // determine required size of buffer
     4466  char pOS2Buffer[4096];
     4467  rc = OSLibNetStatisticsGet((const unsigned char*)asciiServername,
     4468                             (const unsigned char*)lpstrOS2Service,
     4469                             0,
     4470                             iOS2Level,
     4471                             iOS2Options,
     4472                             (unsigned char*)pOS2Buffer,
     4473                             sizeof(pOS2Buffer),
     4474                             &ulBytesAvailable);
     4475 
     4476  if (asciiServername) FreeAsciiString(asciiServername);
     4477 
     4478  // convert the structures
     4479  switch (dwLevel)
     4480  {
     4481    case 0:
     4482      // Note: address comparsion is valid :)
     4483      if (lpstrOS2Service == SERVICE_REQUESTER_NT)
     4484      {
     4485        PSTAT_WORKSTATION_NT_0 pstw0;
     4486        struct stat_workstation_0 *pOS2stw0 = (struct stat_workstation_0 *)pOS2Buffer;
     4487
     4488        // calculate new size for target buffer
     4489        rc = OS2NetApiBufferAllocate(sizeof(STAT_WORKSTATION_NT_0), (LPVOID*)&pstw0);
     4490        if (!rc)
     4491        {
     4492          // buffer is zeroed?
     4493          //memset(pstw0, 0, sizeof(STAT_WORKSTATION_0));
     4494
     4495          UL2LI  (&pstw0->StatisticsStartTime, pOS2stw0->stw0_start);
     4496          LOHI2LI(&pstw0->BytesReceived,       pOS2stw0->stw0_bytesrcvd_r_lo, pOS2stw0->stw0_bytesrcvd_r_hi);
     4497          pstw0->SmbsReceived;
     4498          pstw0->PagingReadBytesRequested;
     4499          pstw0->NonPagingReadBytesRequested;
     4500          pstw0->CacheReadBytesRequested;
     4501          pstw0->NetworkReadBytesRequested;
     4502          LOHI2LI(&pstw0->BytesTransmitted,    pOS2stw0->stw0_bytessent_r_lo, pOS2stw0->stw0_bytessent_r_hi);
     4503          pstw0->SmbsTransmitted;
     4504          pstw0->PagingWriteBytesRequested;
     4505          pstw0->NonPagingWriteBytesRequested;
     4506          pstw0->CacheWriteBytesRequested;
     4507          pstw0->NetworkWriteBytesRequested;
     4508         
     4509          pstw0->InitiallyFailedOperations;
     4510          pstw0->FailedCompletionOperations;
     4511          pstw0->ReadOperations;
     4512          pstw0->RandomReadOperations;
     4513          pstw0->ReadSmbs;
     4514          pstw0->LargeReadSmbs;
     4515          pstw0->SmallReadSmbs;
     4516          pstw0->WriteOperations;
     4517          pstw0->RandomWriteOperations;
     4518          pstw0->WriteSmbs;
     4519          pstw0->LargeWriteSmbs;
     4520          pstw0->SmallWriteSmbs;
     4521          pstw0->RawReadsDenied;
     4522          pstw0->RawWritesDenied;
     4523         
     4524          pstw0->NetworkErrors;
     4525          pstw0->Sessions                   = pOS2stw0->stw0_sesstart;
     4526          pstw0->FailedSessions             = pOS2stw0->stw0_sessfailcon;
     4527          pstw0->Reconnects                 = pOS2stw0->stw0_autorec;
     4528          pstw0->CoreConnects;
     4529          pstw0->Lanman20Connects;
     4530          pstw0->Lanman21Connects;
     4531          pstw0->LanmanNtConnects;
     4532          pstw0->ServerDisconnects;
     4533          pstw0->HungSessions               = pOS2stw0->stw0_sessbroke;
     4534          pstw0->UseCount                   = pOS2stw0->stw0_uses;
     4535          pstw0->FailedUseCount             = pOS2stw0->stw0_usefail;
     4536          pstw0->CurrentCommands;
     4537        }
     4538        // the caller is responsible for freeing the memory!
     4539        *bufptr = (LPBYTE)pstw0;
     4540      }
     4541      else
     4542      if (lpstrOS2Service == SERVICE_REQUESTER_LM)
     4543      {
     4544        // LanmanWorkstation !
     4545        PSTAT_WORKSTATION_LM_0 pstw0;
     4546        struct stat_workstation_0 *pOS2stw0 = (struct stat_workstation_0 *)pOS2Buffer;
     4547
     4548        // calculate new size for target buffer
     4549        rc = OS2NetApiBufferAllocate(sizeof(STAT_WORKSTATION_LM_0), (LPVOID*)&pstw0);
     4550        if (!rc)
     4551        {
     4552          // Note: the really nice thing is, the lanman structures are
     4553          // exactly identical between OS/2 and NT ... :)
     4554          memcpy(pstw0,
     4555                 pOS2stw0,
     4556                 sizeof(STAT_WORKSTATION_LM_0));
     4557        }
     4558       
     4559        // the caller is responsible for freeing the memory!
     4560        *bufptr = (LPBYTE)pstw0;
     4561      }
     4562      else
     4563      if (lpstrOS2Service == SERVICE_SERVER)
     4564      {
     4565        // SERVER !
     4566        PSTAT_SERVER_0 psts0;
     4567        struct stat_server_0 *pOS2sts0 = (struct stat_server_0 *)pOS2Buffer;
     4568
     4569        // calculate new size for target buffer
     4570        rc = OS2NetApiBufferAllocate(sizeof(STAT_SERVER_0), (LPVOID*)&psts0);
     4571        if (!rc)
     4572        {
     4573          // Note: the really nice thing is, the server structures are
     4574          // exactly identical between OS/2 and NT ... :)
     4575          memcpy(psts0,
     4576                 pOS2sts0,
     4577                 sizeof(STAT_SERVER_0));
     4578        }
     4579       
     4580        // the caller is responsible for freeing the memory!
     4581        *bufptr = (LPBYTE)psts0;
     4582      }
     4583   
     4584    break;
     4585  }
     4586 
     4587  return (rc);
     4588}
     4589
     4590
Note: See TracChangeset for help on using the changeset viewer.