|
-
May 17th, 2001, 06:03 AM
#1
Thread Starter
Retired VBF Adm1nistrator
If you know C/C++
If you know c/c++, could you take a look at this thread :
http://www.vbforums.com/showthread.p...threadid=76121
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
May 17th, 2001, 08:08 AM
#2
Frenzied Member
I just looked at the C code and it looks pretty straight forward.
What message, if any, are you getting? Also, please post the Shell statement that you use to execute the app.
-
May 17th, 2001, 08:12 AM
#3
Thread Starter
Retired VBF Adm1nistrator
Well when I try to compile the code, I get these errors :
Code:
--------------------Configuration: share - Win32 Debug--------------------
Compiling...
share.cpp
c:\jamie\share.cpp(28) : error C2440: '=' : cannot convert from 'void *' to 'struct share_info_50 *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
Error executing cl.exe.
share.exe - 1 error(s), 0 warning(s)
If I use his piece of code :
Code:
malloc(cbBuffer);
// instead of :
pBuf = malloc(cbBuffer);
I dont get the above error, but get this one instead :
Code:
--------------------Configuration: share - Win32 Debug--------------------
Compiling...
share.cpp
Linking...
share.obj : error LNK2001: unresolved external symbol __imp__NetShareAdd@16
Debug/share.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
share.exe - 2 error(s), 0 warning(s)
And I would either stick the compiled executable into a login script, or shell it just as retVal = Shell("\\ntserver\shared\blah.exe")
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
May 17th, 2001, 08:49 AM
#4
Frenzied Member
Try casting the result from malloc.
Code:
pBuf = (struct share_info_50*) malloc(cbBuffer);
You need pBuf as it is the pointer to the memory area allocated by malloc.
-
May 17th, 2001, 08:51 AM
#5
Thread Starter
Retired VBF Adm1nistrator
Okay that bit worked, but im still left with the second problem :
Code:
--------------------Configuration: share - Win32 Debug--------------------
Compiling...
share.cpp
Linking...
share.obj : error LNK2001: unresolved external symbol __imp__NetShareAdd@16
Debug/share.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
share.exe - 2 error(s), 0 warning(s)
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
May 17th, 2001, 09:25 AM
#6
Hyperactive Member
i`d suggest making sure you are including all relevant header (.h) files!
-
May 17th, 2001, 09:27 AM
#7
Frenzied Member
I've done a little looking around and I have to say I'm a bit mystified. At http://msdn.microsoft.com/library/ps...api3_8yk2.htm, it says share_info_50 is defined in srvapi.h, which you have as the last include in your code. However, I searched the header file and I can't find it.
I also saw that share_info_50 is not supported in Windows NT/2000. Will this be a problem for you?
Don't know how much more help I can be.
-
May 17th, 2001, 09:27 AM
#8
Thread Starter
Retired VBF Adm1nistrator
As far as I can tell I am.
I took the code as is off the microsoft website.
And as I know very little c my bug tracking is severly hindered
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
May 17th, 2001, 09:29 AM
#9
Thread Starter
Retired VBF Adm1nistrator
/me starts crying

Emmmmm.
Well its all super confusing to me anyway.
And the fact that its not compatible with nt/2k will be a very big problem.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|