So to dot my I's and cross mt T's. Since I did not write this DLL, and have no control over it. This DLL cannot be used in a VB.NET application. Whenever I use
mlauahi
Posts
-
Calling A C++ Dll Frim VB.NET -
Calling A C++ Dll Frim VB.NETI tried this the other day. I now have more information that I did not have before. I have a DLL called spoem.dll I Have a LIB called spoem.lib In C++ there are the lines: #define SPOEM_API __declspec(dllimport) #pragma message("automatic link to spoem.lib") // <== add this line #pragma comment(lib, "spoem.lib") This last line I guess calls a linker the the LIB file. My understanding is that the DLL has no entry points. Each function in C gets linked intot he program calling this line. #pragma comment(lib, "spoem.lib") Is there any way in VB.NET to mimic this same behavior . I need to link this LIB file into my VB.NET project. Thanks
-
C# to VB.NETThats exactly what I did, and it complained about not finding the entry point in the DLL. The example I had was "USBComunication", it said that it could not locate the entry point in the DLL
-
C# to VB.NETIm am stuck right now. The example code that they give you with this is indeed a C++ 6.0 MFC wizard application. They company supplys the .H, .LIB, and the .dll files. The example just shows those original #DEFINE statements, and there is the exported class for the DLL. I am trying to make the DLL wotk in VB.NET. I am not sure why I am getting an: Unable to find an entry point named 'USBCommunication' in DLL 'Spoem.Dll'. If I am understanding you at this point. I do not use the .H or the .LIB. I should only use the
-
C# to VB.NETI copied the SPOEM.DLL to my System32 directory, It now finds the DLL, but it cannot locate the designated Entry Point. One of the function calls is SPOEM.USBCommunication(). When I call this is says: Unable to find an entry point named 'USBCommunication' in DLL 'Spoem' ANy suggestions at this point???
-
C# to VB.NETHello Christain I cannot add a reference to the DLL, it says that it is invalid. I have tried both the DLLIMPORT,and then a simpe Declare It says that it cannot locate the DLL. Where does the DLL need to reside, and how do I tell my class where it is?? Thanks
-
C# to VB.NETI am using _ This line did not appear on the last post
-
C# to VB.NETThanks for your fast reply: I have tried: _ Public Shared Function InitParameter(ByVal chSPDir As char) End Function _ Public Shared Function ExitSpDll() End Function _ Public Shared Function USBCommunication() As BOOLEAN End Function etc..... It says that it cannot find the DLL. I have Spoem.dll, spoem.h, and spoem.lib in the project directory. How do I point this class to the DLL.
-
C# to VB.NETThanks for any guidance. I am working in a gray area that I am not familiar with. I have a DLL by a third party supplier. It has a .H file and a .LIB File. So they have been created in C I am guessing. How do I wrap this DLL so that I call its functions from within VB.NET This is the C# lines from thier example: #ifdef SPOEM_EXPORTS #define SPOEM_API __declspec(dllexport) #else #define SPOEM_API __declspec(dllimport) #pragma message("automatic link to spoem.lib") ' <== add this line #pragma comment(lib, "spoem.lib") ' <== add this line #endif
-
Failed to map the pathWe created an ASP.NET account and made him "Act As Part Of The Operating System". This was a bad thing to do. We removed him from that security setting but all .NET 2.0 ASP.NET applications generate the same error when running IIS under this new ASP.NET account. An Example to SecurityWebService which is a Web Service generates: Exception type: InvalidOperationException Exception message: Failed to map the path '/SecurityWebService/App_GlobalResources/'. There is no App_GlobalResources under this Web Service. When the processmodel line in the machine.config file gets set back to its default, everything works fine, when we change the line to be the new ASP.NET domain account all 2.0 apps fail. Any help????
-
Impersonating And RevertingIm am not sure exactly how to handle this. Most of this was from Microsoft direct. I am hosting a web site. Microsoft had us set up a different ASP.NET Account under which to run IIS. We changed the machine.config file to reflect this new account in the processmodel line. Everything works as designed. When impersonation is off in the web.config file it shows the current user thread as this this ASP.NET account user. When impersonation is on, the calling user is shown on the thread. I need to keep impersonation on, I want to know who my current caller identity is, but when it calls for going to another resoource in my case a printer I want to go out and use this resource as the ASP.NET account. With impersonate on, I then need to impersonate this ASP.NET account for going out to print. I do not want to add everyone to this printer resource. I used the API call to LOGONUSER and passed the token into WindowsIdentity and this works as well. The catch comes in that whatever account calls LOGONUSER and then trys to impersonate this ASP.NET account must have "Act On Behalf Of Operating System" rights. Am I making this more difficult than needs to be. How do I keep impersonation on for identity purposes, but still make use of this ASP.NET account for going outside of my web site to a printer??? Thanks a lot in advance
-
LOGONUSERI figured this out. Whom ever the authenicated user running the application is must have the "Act on behalf of operating system set" under the local security policy settings. If this privledge is not set then LOGONUSER Fauls.
-
LOGONUSERI think I am on the right track. Where do I get a list of what all of these codes mean. I am geeting a failure code of 1314 when I run LogonUser. Thanks
-
LOGONUSERSeems like the documentation says that the API call to Logonuser does not work under the Windows 2000 platform. If I have a username, domain, and password how do I get a token for impersonation? Better yet how do I impersonate this username and password if I don't use Logonuser Thanks
-
.Net 2.0 SecurityWell I did read the entire article and saw what was happening. From everything I saw unless I was not doing it exactly, is that one way to do what I want to do was to Create a permission set, then add the appropriate rights to that permission set and then do a Permission Set DEMAND on it. From his example though it seemed that if He wanted to then check for Create rights he still had to go through the trouble of creating a FileStream Object to see if he really had the rights to do the operation. I have tried the following. Even if I have only Read access only to XPath that this code works all the time, I can never generate a SecurityException Error. TRY DIM DirectoryName AS STRING = XPath DIM PS As New PermissionSet(PermissionState.None) PS.AddPermission(New FileIOPermission(FileIOPermissionAccess.Write, PATH.GetFullPath(XPath))) PS.Demand() RETURN TRUE CATCH EX AS SecurityException RETURN FALSE CATCH EX As Exception RETURN FALSE END TRY I also created a codegroup, and a permissionset using the .NET 2.0 configurator. That gives unrestricted access to the Security, UIPermission, and the FileIOPermission objects. I just want to tell if my current user can create in a given directory, or if they can read from a given directory etc. Any further ideas as to why I cannot trap an error above?
-
.Net 2.0 SecurityI tried the VB.NET forum, but maybe that was the wrong forum. What I need to do is check what rights that the current authenticated user has on a given file or directory. If the code needs to create a directory(sub-folder) does the current user have Create rights. If the current user needs to write in a directory do they have the Write permissions. I have tried several renditions of the following which is from the Microsoft Help section. This code seems add the access rule even when I don't have the rights do this TRY Dim dInfo As New DirectoryInfo(FileName) Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl() dSecurity.AddAccessRule(New FileSystemAccessRule(Account, Rights, ControlType)) dInfo.SetAccessControl(dSecurity) CATCH END TRY
-
.NET Security QuestionI have attempted to use some of the new security classes in .NET 2.0. Question. How can I check the writes of the currently logged in user for a given resource suce as a file/directory. I want to know before taking an action if a user can write to a directory, can the user create a sub directory in a given directory on the network. Here is what I have tried: PUBLIC FUNCTION ReturnCheckMyRightsOnDirectory(XRightsToCheck AS DirectoryPermissions , XPath AS STRING) AS BOOLEAN IF MY.Computer.FileSystem.DirectoryExists(XPath) = FALSE THEN RETURN FALSE END IF TRY DIM DirectoryName AS STRING = XPath Dim dInfo AS NEW DirectoryInfo(DirectoryName) Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl() DIM DirectoryRightToCheck AS FileSystemRights SELECT CASE XRightsToCheck CASE DirectoryPermissions.Create DirectoryRightToCheck = FileSystemRights.CreateDirectories CASE DirectoryPermissions.Read DirectoryRightToCheck = FileSystemRights.Read CASE DirectoryPermissions.Update DirectoryRightToCheck = FileSystemRights.Modify CASE DirectoryPermissions.Delete DirectoryRightToCheck = FileSystemRights.Delete CASE DirectoryPermissions.Write DirectoryRightToCheck = FileSystemRights.Write CASE DirectoryPermissions.Execute DirectoryRightToCheck = FileSystemRights.ExecuteFile CASE DirectoryPermissions.Admin DirectoryRightToCheck = FileSystemRights.FullControl END SELECT dSecurity.AddAccessRule(New FileSystemAccessRule(SystemUserName, DirectoryRightToCheck, AccessControlType.Allow)) dInfo.SetAccessControl(dSecurity) RETURN TRUE CATCH ex As Exception RETURN FALSE END TRY END FUNCTION
-
How to add properties to TreelistView User controlPUBLIC CLASS TopVaultNode INHERITS TreeNode PUBLIC Type AS STRING PUBLIC NodeId AS GUID PUBLIC ParentId AS GUID PUBLIC Description AS STRING PUBLIC UserRights AS INTEGER SUB NEW(ByVal XType AS STRING, byval XNodeId AS GUID, XParentID AS Guid, ByVal XDescription As String, XUserRights AS INTEGER) MYBASE.NEW() ME.Type = XType ME.NodeId = XNodeId ME.ParentId = XParentId ME.Description = XDescription ME.UserRights = XUserRights ME.ImageIndex = NodeColorsAndIndexs.imageindexes.VAULT ME.SelectedImageIndex = NodeColorsAndIndexs.SelectedImageIndexes.VAULT ME.ForeColor = Color.Black ME.Text = Trim(ME.Description) END SUB END CLASS