Einzelnen Beitrag anzeigen

Olli
(Gast)

n/a Beiträge
 
#16

Re: Mindest Passwort länge unter NT

  Alt 12. Okt 2005, 13:07
Zitat von Luckie:
Die Doku habe ich gelesen.
Ich hoffe das ist als Witz gemeint. Schau mal was im PSDK bei der Beschreibung von MSDN-Library durchsuchenNetUserModalsGet steht.

Zitat:
bufptr
[out] Pointer to the buffer that receives the data. The format of this data depends on the value of the level parameter. This buffer is allocated by the system and must be freed using the MSDN-Library durchsuchenNetApiBufferFree function. For more information, see Network Management Function Buffers and Network Management Function Buffer Lengths.
Dann wäre da noch folgendes Beispiel, wo dir spätestens dein Fehler hätte bewußt werden müssen:
Code:
#ifndef UNICODE
#define UNICODE
#endif

#include <stdio.h>
#include <windows.h>
#include <lm.h>

int wmain(int argc, wchar_t *argv[])
{
   DWORD dwLevel = 0;
   [color=red]USER_MODALS_INFO_0 *pBuf = NULL;[/color]
   NET_API_STATUS nStatus;
   LPTSTR pszServerName = NULL;

   if (argc > 2)
   {
      fwprintf(stderr, L"Usage: %s [\\\\ServerName]\n", argv[0]);
      exit(1);
   }
   // The server is not the default local computer.
   //
   if (argc == 2)
      pszServerName = argv[1];
   //
   // Call the NetUserModalsGet function; specify level 0.
   //
   nStatus = NetUserModalsGet(pszServerName,
                              dwLevel,
                              [color=red](LPBYTE *)&pBuf);[/color]
   //
   // If the call succeeds, print the global information.
   //
   [color=red]if (nStatus == NERR_Success)
   {
      if (pBuf != NULL)[/color]
      {
         printf("\tMinimum password length: %d\n", pBuf->usrmod0_min_passwd_len);
         printf("\tMaximum password age (d): %d\n", pBuf->usrmod0_max_passwd_age/86400);
         printf("\tMinimum password age (d): %d\n", pBuf->usrmod0_min_passwd_age/86400);
         printf("\tForced log off time (s): %d\n", pBuf->usrmod0_force_logoff);
         printf("\tPassword history length: %d\n", pBuf->usrmod0_password_hist_len);
      }
   }
   // Otherwise, print the system error.
   //
   else
      fprintf(stderr, "A system error has occurred: %d\n", nStatus);
   //
   // Free the allocated memory.
   //
   [color=red]if (pBuf != NULL)
      NetApiBufferFree(pBuf);[/color]

   return 0;
}
Zitat von Luckie:
Was habe ich denn falsch gesmcht?
Habe ich oben als Punkt 1 und 2 geschrieben. Deinen und meinen Prototypen zu vergleichen sollte nicht zuviel verlangt sein, oder? ... aber ich will mal nicht so sein:
Code:
[b]function[/b] NetUserModalsGet(Servername: LPCWSTR; Level: DWORD; [color=red][u]var[/u][/color] bufptr: Pointer): DWORD; [b]stdcall[/b]; [b]external[/b] 'Netapi32.dll';
  Mit Zitat antworten Zitat