473,236 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,236 software developers and data experts.

C# - calling Novell function (problem with variable types?)


Can anyone help me with calling Novell function from dll?
I think my main problem is in translating C variable types to C# types.

Here is the code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Globalization;

//declaring my class
public class IcNovell
[DllImport("calwin32.dll", CharSet = CharSet.Auto)]

public static extern int NWCallsInit(Byte reserved1, Byte

[DllImport("netwin32.dll", EntryPoint =
"NWDSCreateContextHandle", CharSet = CharSet.Auto, CallingConvention =
CallingConvention.Winapi, SetLastError = true)]

public static extern int GetHandle(out long context);

[DllImport("netwin32.dll", EntryPoint = "NWDSWhoAmI", CharSet =
CharSet.Auto, CallingConvention = CallingConvention.ThisCall,
SetLastError = true)]

public static extern int GetUser(long context, out string[]


//calling functions
// init
int cCode = IcNovell.NWCallsInit(0, 0);

long NovellContext = 0;
int RetCode0 = 0;
// get the context handle
RetCode0 = IcNovell.GetHandle(out NovellContext);
MessageBox.Show("RetCode0 is: " + RetCode0.ToString());
MessageBox.Show("Context is: "+NovellContext.ToString());
// my NovellContext equals 1 (looks good)

//string variable for user name
string[] NovellUserId = new string[255];
for (int i = 0; i < 255; i++)
NovellUserId[i] = " ";

int RetCode = 0;
// get the user name
RetCode = IcNovell.GetUser(NovellContext, out NovellUserId);
string hexValue = RetCode.ToString("X");
MessageBox.Show("RetCode is:" + hexValue);

At this point my RetCode is "FFFFFED1", which means (from Novell
documentation) "Trying to pass a bad context parameter to a NDS
function. Call NWDSCreateContextHandle first and use its return value as
the context parameter."
I think that variable NovellContext has wrong type (i got: long
NovellContext, maybe it should be IntPtr?).

In Novell documentation function declarations look like this:

#include <nwnet.h>
#include <nwdsdc.h>

NWDSContextHandle N_FAR *newHandle);


#include <nwnet.h>
#include <nwdsdsa.h>

NWDSContextHandle context,
pnstr8 objectName);
Any help will be appreciated.

Best regards,
Dec 6 '05 #1
0 1907

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Alex Lyman | last post by:
Does anyone have any code handy (or know what a good direction for me to head in), to call functions, if you have an address of the function, its declspec (for my app, it's limited to _stdcall and...
by: Muthu | last post by:
I've read calling conventions to be the order(reverse or forward) in which the parameters are being read & understood by compilers. For ex. the following function. int Add(int p1, int p2, int...
by: komal | last post by:
hi all basically my problem is i have to write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function...
by: Joe | last post by:
I have 3 functions: ClientInfoA is doing something ClientInfoB is doing something SelectFunction2Run is a function to determine which function needed to run based on the value of the variable...
by: Gibby Koldenhof | last post by:
Hiya, I'm setting up some code in the spirit of Design Patterns, OOP, etc. All nice and well, it handles pretty much all OO style things and serves my purposes well. There's one last final...
by: 1388-2/HB | last post by:
On a W2K3 box running IIS 6 I have a web app that implements Forms Authentication mixed with AD (the login page autheticates users against AD & impersonates them with each page request). This...
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
by: Nogema | last post by:
Hi everybody I use VB 2005 One of our project consisting in saving data on a network disk (NOVELL Sever) This project use windows authentification for each attempt to write on the disk,...
by: Ole Nielsby | last post by:
VC has a __cdecl specifier which allows functions and methods to be called with varying parameter count. (I understand this is the default for functions in general but in VC, instances use...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.