This code prints names of loaded NLMs together with the amount of memory they allocated.
#include <nit\nwservst.h>
#include <nwconio.h>
#include <nwerrno.h>
#include <stdio.h>
#include <stdlib.h>
union NLMList {
BYTE buffer[ SS_DEFAULT_BUFFER_SIZE];
struct GetNLMLoadedListStructure s;
};
union NLMInfo {
BYTE buffer[ SS_DEFAULT_BUFFER_SIZE];
struct GetNLMInfoStructure s;
};
int main( void) {
LONG startNumber = 0;
union NLMList list;
LONG ccode;
if (( ccode = SSGetNLMLoadedList( 0, list.buffer, sizeof( list))) != ESUCCESS) {
printf( "SSGetNLMLoadedList failed, ccode = %u\n", ccode);
return EXIT_FAILURE;
}
do {
size_t i;
printf( "*** NLMCount = %u\n", list.s.NLMCount);
for ( i = 0; i < list.s.NLMCount; ++i) {
union NLMInfo info;
printf( "%4u ", ( &( list.s.NLMNumbers))[ i]);
if (( ccode = SSGetNLMInfo(( &( list.s.NLMNumbers))[ i], info.buffer, sizeof( info))) != ESUCCESS) {
printf( "SSGetNLMInfo failed, ccode = %u\n", ccode);
return EXIT_FAILURE;
}
printf( "%-12.*s %6d %6d\n",
info.s.startOfLStrings, &info.s.startOfLStrings + 1,
info.s.NLMInfo.nlmAllocAvailBytes,
info.s.NLMInfo.nlmAllocFreeCount);
}
startNumber = ( &( list.s.NLMNumbers))[ list.s.NLMCount - 1] + 1;
} while ( SSGetNLMLoadedList( startNumber, list.buffer, sizeof( list)) == ESUCCESS && list.s.NLMCount != 0);
PressAnyKeyToContinue();
return EXIT_SUCCESS;
}
© 2008 Novell, Inc. All Rights Reserved.