Click here to Skip to main content
15,310,056 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi,

I wnat to create a new attribute in my domain active directory schema in a MFC project.

There is a C++ sample code in Microsoft's website but I am unable to use it correctly. It returns some exception about stack!

Any help?
Thanks in advance
Posted
Updated 15-Feb-11 6:16am
v2
Comments
Nish Nishant 15-Feb-11 10:30am
   
Link to the article you are using, and post some code and show exactly where you are getting the stack error.
mosafermsfmsf 15-Feb-11 12:37pm
   
hi thank a lot for your attention
sorry it is my first question Wink

this is my sample code article link:

http://msdn.microsoft.com/en-us/library/ms676321(VS.85).aspx[^]

in this line :

hr = spSchemaCont->Create(CComBSTR("attributeSchema"),
sbstrAttribute,
&spDisp);

it shows this message:
the value of esp was not properly saved across a function.....

do you know it?
OriginalGriff 15-Feb-11 10:32am
   
That's not really very helpful, you know!
Did it give you any more information than "some exception about stack!!!"? Perhaps an error message? With a file name, and line number?
Perhaps it occurs in a particular function?
If you were to edit your question and include some of that, it might help us to help you...
mosafermsfmsf 16-Feb-11 5:25am
   
hi thank a lot for your attention
sorry it is my first question Wink

this is my sample code article link:

http://msdn.microsoft.com/en-us/library/ms676321(VS.85).aspx[^]

in this line :

hr = spSchemaCont->Create(CComBSTR("attributeSchema"),
sbstrAttribute,
&spDisp);

it shows this message:
the value of esp was not properly saved across a function.....

do you know it
cariolihome 16-Feb-11 18:23pm
   
In code
// Bind to the IADsContainer interface of the schema container.
CComPtr<iadscontainer> spSchemaCont;
hr = ADsOpenObject( L"LDAP://RootDSE",
NULL,
NULL,
ADS_SECURE_AUTHENTICATION,
IID_IADs,
(void**)&spSchemaCont);
replace IID_IADs with IID_IADsContainer
mosafermsfmsf 20-Feb-11 6:38am
   
hi cariolihome
thanks a lott for you answare.
but i have a new problem.
setinfo() method returns :
8007200b the attribute syntax specified to the directory service is invalid!

this is my code :
CreateAttribute(L"KNLTEST",L"KNLTEST",L"1.2.840.113556.1.8000.2554.19665.55862.12361.16573.35533.6395497.8339742.2.1",NULL,L"2.5.5.9",2,NULL,NULL,L"KNLTEST",false,false,false,0,0,0,L"KNLTEST",&paddnewattribute);
hr = paddnewattribute->SetInfo();
2.5.5.9 is integer syntax!what is wrong?!
cariolihome 20-Feb-11 15:32pm
   
According to the
http://msdn.microsoft.com/en-us/library/cc228435(v=PROT.13).aspx
try to specify "Integer", instead "2.5.5.9"
mosafermsfmsf 23-Feb-11 1:14am
   
hi I had seen many codes that specify syntax with numeric format sam as "2.5.5.9"!
anyway i had changed the code to the "integer" but i have still another error on setinfo():

8007200a The specified directory service attribute or value does not exist.

every "hr" in the function are S_OK!

these are my parameters and calling setinfo()


static const GUID attrGuid =
{ 0xc45f05b2, 0x4d16, 0x11d2, { 0x80, 0xe, 0x0, 0x80, 0xc7, 0x66, 0x70, 0xc0 } };
// {C45F05B2-4D16-11d2-800E-0080C76670C0}

CreateAttribute(L"KNLTEST",L"KNLTEST",L"1.2.840.113556.1.8000.2554.19665.55862.12361.16573.35533.6395497.8339742.2.1",&attrGuid,L"integer",2,NULL,NULL,L"KNLTEST",true,true,true,0,0,0,L"KNLTEST",&paddnewattribute);

hr = paddnewattribute->SetInfo();

thanks a lot for your time

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900