

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
7 messages in net.java.dev.jna.usersFinding Access violations| From | Sent On | Attachments |
|---|---|---|
| Thomas Börkel | May 21, 2008 8:07 am | |
| Timothy Wall | May 22, 2008 1:41 pm | |
| Timothy Wall | May 22, 2008 1:43 pm | |
| Thomas Börkel | May 22, 2008 11:53 pm | |
| Thomas Börkel | May 23, 2008 12:32 am | |
| Timothy Wall | May 23, 2008 6:14 am | |
| Thomas Börkel | May 28, 2008 9:53 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Finding Access violations | Actions... |
|---|---|---|
| From: | Thomas Börkel (tho...@boerkel.de) | |
| Date: | May 21, 2008 8:07:26 am | |
| List: | net.java.dev.jna.users | |
HI!
I got some crashes SOMETIMES in my program, so I searched for possible programming errors in native code access. To do this, I attached the Visual Studio 2005 debugger, because it prints out Access violations in its output window:
First-chance exception at 0x6d871015 in java.exe: 0xC0000005: Access violation writing location 0x003e0b80. First-chance exception at 0x6d871015 in java.exe: 0xC0000005: Access violation writing location 0x003e0b80. First-chance exception at 0x0091e252 in java.exe: 0xC0000005: Access violation writing location 0x003e0b80.
Problem is, those violations do not happen consistently, so maybe something with heap corruption.
Problem is, I cannot find an error. Maybe I did something wrong that I cannot see.
Any hints would be greatly appreciated.
Thanks!
Thomas
These are the code fragments:
Netapi32 netapi32; TreeSet<String> domainGroups; IntByReference returnedEntries; PointerByReference sortedBuf; Structure[] displayGroups; Netapi32.NET_DISPLAY_GROUP displayGroup; int index, ret, i;
netapi32 = Netapi32.INSTANCE; domainGroups = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); returnedEntries = new IntByReference(); sortedBuf = new PointerByReference(); index = 0;
do { ret = netapi32.NetQueryDisplayInformation(DOMAIN_CONTROLLER_NAME, 3, index, 1000, LMCONS.MAX_PREFERRED_LENGTH, returnedEntries, sortedBuf);
if(ret == WINERROR.NO_ERROR || ret == WINERROR.ERROR_MORE_DATA) { displayGroup = new Netapi32.NET_DISPLAY_GROUP(sortedBuf.getValue()); displayGroups = displayGroup.toArray(returnedEntries.getValue());
for(i = 0; i < returnedEntries.getValue(); i++) { displayGroup = (Netapi32.NET_DISPLAY_GROUP)displayGroups[i]; domainGroups.add(displayGroup.grpi3_name); index = displayGroup.grpi3_next_index; } netapi32.NetApiBufferFree(sortedBuf.getValue()); } } while(ret == WINERROR.ERROR_MORE_DATA);
/* NET_API_STATUS NetQueryDisplayInformation( __in LPCWSTR ServerName, __in DWORD Level, __in DWORD Index, __in DWORD EntriesRequested, __in DWORD PreferredMaximumLength, __out LPDWORD ReturnedEntryCount, __out PVOID *SortedBuffer );*/ public int NetQueryDisplayInformation(String ServerName, int Level, int Index, int EntriesRequested, int PreferredMaximumLength, IntByReference ReturnedEntryCount, PointerByReference SortedBuffer);
/* typedef struct _NET_DISPLAY_GROUP { LPWSTR grpi3_name; LPWSTR grpi3_comment; DWORD grpi3_group_id; DWORD grpi3_attributes; DWORD grpi3_next_index; } NET_DISPLAY_GROUP, *PNET_DISPLAY_GROUP;*/ public static class NET_DISPLAY_GROUP extends Structure { public NET_DISPLAY_GROUP() { super(); }
public NET_DISPLAY_GROUP(Pointer memory) { useMemory(memory); read(); }
public String grpi3_name; public String grpi3_comment; public int grpi3_group_id; public int grpi3_attributes; public int grpi3_next_index; }







