473,654 Members | 3,062 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Documentation error

Can
From the MSN documentation;

"By default, /CLRUNMANAGEDCOD ECHECK is in effect, which means
SuppressUnmanag edCodeSecurityA ttribute is applied to linker-generated
PInvoke calls. Specify /CLRUNMANAGEDCOD ECHECK:NO to not apply this
attribute."

But it seems it's just the opposite (which sounds more logical). By default
no SuppressUnmanag edCodeSecurityA ttribute is applied to the C++ interop
calls. And /CLRUNMANAGEDCOD ECHECK:NO must be specified to apply the
attribute.

There is also a "bug" in Visual Studio. If you specify
AllowPartiallyT rustedCallers attribute, you must explicitly set the
/CLRUNMANAGEDCOD ECHECK[:NO] switch, but there is no way to set it as
/CLRUNMANAGEDCOD ECHECK:NO.

Can
Feb 15 '07 #1
4 1757
Hi Can!
"By default, /CLRUNMANAGEDCOD ECHECK is in effect, which means
SuppressUnmanag edCodeSecurityA ttribute is applied to linker-generated
PInvoke calls. Specify /CLRUNMANAGEDCOD ECHECK:NO to not apply this
attribute."
Yes, this seems to be a docu bug...
But it seems it's just the opposite (which sounds more logical). By default
no SuppressUnmanag edCodeSecurityA ttribute is applied to the C++ interop
calls.
I can't confirm that...
If I specify *nothing* in the linker options it will generate the
following PInvoke declaration:

[MethodImpl(Meth odImplOptions.U nmanaged,
MethodCodeType= MethodCodeType. Native),
SuppressUnmanag edCodeSecurity,
DllImport("", EntryPoint="",
CallingConventi on=CallingConve ntion.StdCall,
SetLastError=tr ue)]
public static extern unsafe int modopt(CallConv Stdcall)
GetUserNameW(ch ar*, uint modopt(IsLong)* );

=SuppressUnmana gedCodeSecurity is applied!

If I specify "/CLRUNMANAGEDCOD ECHECK", it will *not* apply the attribute:

[MethodImpl(Meth odImplOptions.U nmanaged,
MethodCodeType= MethodCodeType. Native),
DllImport("", EntryPoint="", CallingConventi on=CallingConve ntion.StdCall,
SetLastError=tr ue)]
public static extern unsafe int modopt(CallConv Stdcall)
GetUserNameW(ch ar*, uint modopt(IsLong)* );
If I specify "/CLRUNMANAGEDCOD ECHECK:NO", it will *apply* the attribute:
[MethodImpl(Meth odImplOptions.U nmanaged,
MethodCodeType= MethodCodeType. Native),
SuppressUnmanag edCodeSecurity,
DllImport("", EntryPoint="",
CallingConventi on=CallingConve ntion.StdCall,
SetLastError=tr ue)]
public static extern unsafe int modopt(CallConv Stdcall)
GetUserNameW(ch ar*, uint modopt(IsLong)* );
And /CLRUNMANAGEDCOD ECHECK:NO must be specified to apply the
attribute.
Or you do not apply this option at all.

In short:

No linker option: =SuppressUnmana gedCodeSecurity
/CLRUNMANAGEDCOD ECHECK =*no* SuppressUnmanag edCodeSecurity
/CLRUNMANAGEDCOD ECHECK:NO =SuppressUnmana gedCodeSecurity

Tested with VS2005-SP1 and the following code:
#include <windows.h>
#pragma comment(lib, "Advapi32.l ib")

namespace Foo
{
ref class Bar
{
void Test()
{
TCHAR szStr[100];
DWORD dwSize = 100;
BOOL bRet = GetUserName(szS tr, &dwSize);
DWORD dw = GetLastError();
}
};
}

int main()
{
}

Greetings
Jochen
Feb 15 '07 #2
Can
Thank you for your reply.
>I can't confirm that...
If I specify *nothing* in the linker options it will generate the
following PInvoke declaration:
I guess I made a mistake by the "no switch" test. Sorry for that.
>If I specify "/CLRUNMANAGEDCOD ECHECK:NO", it will *apply* the attribute:
How do you specify "/CLRUNMANAGEDCOD ECHECK:NO" in Visual Studio? Because
when I try to set it through the project properties dialog (by selecting
"No" for the "CLR unmanaged code check" field) , VS just removes the switch
from the command line instead of appending "/CLRUNMANAGEDCOD ECHECK:NO". If
you do not use the AllowPartiallyT rustedCallers attribute, it does not
matter, because the default is NO switch anyway. But otherwise the linker
gives me a warning.

Again from the MSDN doc;

"Note that if you use AllowPartiallyT rustedCallersAt tribute in your code,
you should explicitly set /CLRUNMANAGEDCOD ECHECK:NO. It is potential
security vulnerability if an image contains both the
SuppressUnmanag edCodeSecurity and AllowPartiallyT rustedCallers attributes."

For now I manually append the switch.

Regards;
Can
Feb 15 '07 #3
Hi Can!
How do you specify "/CLRUNMANAGEDCOD ECHECK:NO" in Visual Studio?
I added it in
"Linker|Com mand Line|Additonal Options"
;-)

Greetings
Jochen
Feb 15 '07 #4
Can
Oh I see :)

Thank you very much...

Regards
Can

"Jochen Kalmbach [MVP]" <no************ ********@holzma .dewrote in message
news:OM******** ******@TK2MSFTN GP02.phx.gbl...
Hi Can!
>How do you specify "/CLRUNMANAGEDCOD ECHECK:NO" in Visual Studio?

I added it in
"Linker|Com mand Line|Additonal Options"
;-)

Greetings
Jochen

Feb 16 '07 #5

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

Similar topics

1
2877
by: Brian Beck | last post by:
Hi. I'm having some problems with code based directly on the following httplib documentation code: http://www.zvon.org/other/python/doc21/lib/httplib-examples.html I've included the code and traceback at the end of this post. The odd thing is, using DEPRECATED FUNCTIONS to perform the same function works fine!
2
1500
by: Andy Fish | last post by:
Hi, I an trying to figure out how to use some browser objects like screen, window, parent, document, top etc. These are available as built-in global variables when programming the browser using javascript. it seems that they are not part of the HTML DOM (well, "document" is but properties like "document.location" aren't) so I don't know where to look. They are described in netscape's documentation for javascript 1.3 but that
4
1900
by: PaulThomas | last post by:
WHY does the .Net Documentation show http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebsessionstatehttpsessionstatememberstopic.asp .NET Framework Class Library HttpSessionState Public Properties Item = = = Overloaded. Gets or sets individual session values. In C#, this property is the indexer for the HttpSessionState class. THEN using the MSDE example walkthrough: int intImageId =...
1
4593
by: Kal | last post by:
Hello, System.Data.SqlClient.SqlException: General network error. Check your network documentation. What does this error means? My web app, suddenly started to show this error today in my production environment, beta environment, development environment, and also on my machine too. When i debugged the app, i see that the error is happening when the
4
1231
by: Peter | last post by:
I found a minor error in the Python documentation for 2.4 which I thought I would report. But after a while I gave up. I wonder if this sort of reporting which is less than a bug could be made easier? The error was that the index entry to 'print statement' sent me to http://www.python.org/doc/2.4.2/lib/types.html#l2h-90. From the point of view of making Python accessible this sort of typo should be easily reportable.
40
2784
by: GTi | last post by:
Is there any source code documentation tools available for Visual Studio 2005 ? I have created a LIB that must be documented. Must I do it by hand or is it some kind of tools to pre document my source code?
1
2084
by: John Nagle | last post by:
If you try to open a password protected page with "urllib.urlopen()", you get "Enter username for EnterPassword at example.com:" on standard output, followed by a read for input! This seems to be an undocumented feature, if not a bug. Definitely the documentation for "urllib" should mention this. The effects of this in a CGI program are not good. A workaround is described here: "http://cis.poly.edu/cs912/urlopen.txt"
4
1273
by: Shatadal | last post by:
In the python documentation section 14.3.2.6 (http://docs.python.org/ lib/optparse-generating-help.html) in the last line it is written "options that have a default value can include %default in the help string--optparse will replace it with str() of the option's default value. If an option has no default value (or the default value is None), %default expands to none." However this is true only for python 2.4 and newer and not for...
0
2182
by: johnkamal | last post by:
Hi, Some times while opening a page, I am getting the following error message, Please help me to rectify the problem. Server Error in '/' Application. General network error. Check your network documentation. Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception...
7
1413
by: Anita Kean | last post by:
Hello I just downloaded the new python2.6 documentation, full of hopes it would solve some basic mysteries for me. I'm new to python, so please forgive my ignorance. I've two questions. 1) Everywhere in the old and new documentation, the string of characters "::=" is used in "explaining" things - but I can nowhere find any stated meaning of this string.
0
8376
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8708
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.