Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3609162
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:35:31+00:00 2026-05-18T21:35:31+00:00

I am using Delphi 2010, latest version (from repository) of JEDI WinAPI and Windows

  • 0

I am using Delphi 2010, latest version (from repository) of JEDI WinAPI and Windows Security Code Library (WSCL).

I don’t know how to call the NetUserSetGroups function. The way I am doing it, it is throwing an exception:

Access violation at address 5B8760BE
in module ‘netapi32.dll’. Write of
address 00000000.

Following is my code:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, JwaWindows, JwsclSid;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  NetApiStatus: NET_API_STATUS;
  dwEntriesRead, dwEntriesTotal: PDWORD;
  lgi01: LOCALGROUP_USERS_INFO_0;
  username: PChar;
begin
  username := 'Elise';

  NetApiStatus := NetUserGetLocalGroups(nil, PChar(username), 0, LG_INCLUDE_INDIRECT, PByte(lgi01),
    MAX_PREFERRED_LENGTH, dwEntriesRead, dwEntriesTotal);
  if NetApiStatus = NERR_SUCCESS then
    showmessage('Total groups user belongs to: ' + IntTostr(dwEntriesTotal^));

end;

end.

Would appreciate if someone could kindly show me how I can call this function?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:35:32+00:00Added an answer on May 18, 2026 at 9:35 pm

    This code works fine for me:

    type
      LocalGroupUsersInfo0Array = array[0..ANYSIZE_ARRAY-1] of LOCALGROUP_USERS_INFO_0;
      PLocalGroupUsersInfo0Array = ^LocalGroupUsersInfo0Array;
    
    procedure TForm3.Button3Click(Sender: TObject);
    var
      nas: NET_API_STATUS;
      PLGUIA: PLocalGroupUsersInfo0Array;
      Count: DWORD;
      Total: DWORD;
      i: Integer;
    begin
      PLGUIA := nil;
      nas := NetUserGetLocalGroups(nil, PChar('rweijnen'), 0, LG_INCLUDE_INDIRECT,
        PByte(PLGUIA), MAX_PREFERRED_LENGTH, @Count, @Total);
    
      if (nas =  NERR_Success) or (nas = ERROR_MORE_DATA) then
      begin
        for i := 0 to Count - 1 do
        begin
          Memo1.Lines.Add(Format('name=%s', [PLGUIA^[i].lgrui0_name]));
        end;
    
        if Assigned(PLGUIA) then
          NetApiBufferFree(PLGUIA);
      end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: Delphi 2010 running the latest Indy version from svn trunk. I have an
Using Delphi 2010 and a patched version of the BDE I run into a
I'm using Delphi 2010 on Windows 7 and have a problem with single quotes
Is there a way (on windows using Delphi 2010) to get the number of
I need to read from and write to Excel spreadsheets using Delphi 2010. Nothing
Possible Duplicate: How to get images from URL in Delphi I'm using Delphi 2010,with
I am using Delphi 2010 with Tim Anderson's SQLite wrapper (unicode version) Have a
(Using Delphi 2010 + latest SQLite in WAL mode) I'm using DISQLite (Delphi port
I have this delphi code that basically download a file (using Delphi 2010 +
I am using Delphi 2010 to build a Win32 GUI application running on Windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.