?
Solved

Calling an api sub

Posted on 2006-03-21
13
Medium Priority
?
377 Views
Last Modified: 2013-12-18
I've asked this before and thought I was given enough info to resolve my problem , what am I doing wrong??. I have other calls to the dll that are functions that work. It's the sub that fails.

Code is in an agent

Here is parts of the code

First my declaration:

Declare Sub Get_Noise Lib "C:\Bits\Raffles\SG100\SG100\ISAF_N1.dll" Alias "_Get_Noise_std@16" (Byte_PTR as String , Byval Bytes As Long,  Byval Error_Code As Long, Byval Exception As Long)

Dim gstr as string
gstr=Space(8)
ErrorCode=1
Exception=1
Call Get_Noise(gstr,1,ErrorCode, Exception)

When the Call executes , the app crashes, so I'm sending wrong info to the dll. I've tried all sotrs of variations to no avail. Below is the only documentation I have for this dll. Addionally , what does the asterisk signify in the first line?
********************************************************
void Get_Noise( uchar *Byte_PTR, ulong Bytes, ulong *Error_Code, ulong
*Exception);
The call returns a string, of specified length, of random bytes, to
memory buffer at address Byte_PTR.

File Type: DLL

         Section contains the following Exports for ISAF_N1.DLL

                   0 characteristics
            3EADF853 time date stamp Tue Apr 29 03:58:11 2003
                 0.0 version
                   1 base
                  10 # functions
                  10 # names

            ordinal hint   name

                  1    0   DLL_Setup  (00001460)
                  3    1   Get_Noise  (000023b0)
                  4    2   Get_Noise_Ex  (000027f0)
                  7    3   Init_Noise_Thread  (000013a0)
                  8    4   Insert_Ciphertext  (00002b50)
                  9    5   Insert_Noise  (000019e0)
                  A    6   Release_UpdateLock  (00002d30)
                  C    7   SG100_Password  (00002f70)
                  E    8   SG100_Random  (00002e60)
                 10    9   Set_Status_Noise_Thread  (00001610)
                  2    A   _DLL_Setup_std@8  (00001440)
                  5    B   _Get_Noise_Ex_std@20  (000027c0)
                  6    C   _Get_Noise_std@16  (00002390)
                  B    D   _Release_UpdateLock_std@8  (00002d10)
                  D    E   _SG100_Password_std@16  (00002f50)
                  F    F   _SG100_Random_std@12  (00002e40)

     Summary

        2000 .bss
        2000 .data
        1000 .edata
        1000 .idata
        1000 .rdata
        1000 .reloc
        1000 .rsrc
        1000 .sdata
        6000 .text
********************************************************
0
Comment
Question by:questfar
  • 6
  • 3
  • 2
11 Comments
 
LVL 22

Accepted Solution

by:
mbonaci earned 500 total points
ID: 16246206
Hi questfar,
* means that it is a pointer to the variable of that type (uchar* - pointer on unsigned char)

Hope this helps,
Marko
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16246325
questfar,
if something is pointer that means it cannot be sent byval (you're sending the copy of the object where the four byte pointer on an object is expected).

Hope this helps,
Marko
0
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 500 total points
ID: 16247232
ByVal means that a parameter is passed by value. I think you need a different specification, like:

    Declare Sub Get_Noise Lib "C:\Bits\Raffles\SG100\SG100\ISAF_N1.dll" Alias "_Get_Noise_std@16" _
    (Byte_PTR as String , Byval Bytes As Long,  Error_Code As Long, Exception As Long)

I have to check about the string, I'll be bakk...
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16247271
See the Designer Help database:
    "Passing arguments to C functions"  
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16247276
And, as I said, byVal (or "by value") means that the copy of the object is sent to the function, not the reference (memory location pointer) to that object.


Marko
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16247305
questfar,

I think you need to "play" a little with params:
http://www.experts-exchange.com/Applications/Email/Lotus_Notes_Domino/Q_20702748.html

Hope this helps,
Marko
0
 

Author Comment

by:questfar
ID: 16248857
I've resolved the problem. The declaration was using byval in the Error_code and Exception, Romoving ByVal resolved problem

I'll give 50 point for the answers posted

Thanks
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16248900
questfar,
what?

this is from my second post:

> if something is pointer that means it cannot be sent byval (you're sending the copy of the object where the four byte pointer on an object is expected).


Hope this helps,
Marko
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16248954
Please read http://www.experts-exchange.com/help.jsp#hi73 for how to grade a question. A <C> is out of the question, even a <B> isn't enough. You got good assistance from both of us. Would you be so kind to reconsider your grading?
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16249001
questfar,
and why did you give grade C ???

:(

Marko
0
 

Author Comment

by:questfar
ID: 16249215
I'll regrade. The answers didn't assist me in resolving the issue. I resolved it from info elsewhere. But I read the guidelines and it makes to regrade.

Thanks for the quick responses

Orlando
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question