NetValidatePasswordPolicy issue on XP - visual-c++

My project has a requirement that it needs to check the password complexity before create the new account.
My code looks like:
NET_API_STATUS status;
NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG inputArg = {0};
NET_VALIDATE_OUTPUT_ARG* pOutputArg = NULL;
inputArg.ClearPassword = NewPass;
inputArg.PasswordMatch = TRUE;
status = NetValidatePasswordPolicy(DC, NULL, NetValidatePasswordChange,
&inputArg, (void**)&pOutputArg);
printf("status: %d, validationStatus: %d\n", status, pOutputArg->ValidationStatus);
NetValidatePasswordPolicyFree((void**)&pOutputArg);
I am working on windows XP.When I try to run, it prompt waring saying:
The procedure entry point NetValidPasswordPolicyFree could not be located in the dynamic link library NETAPI32.dll
From the MSDN it said the API is only valid in 2003 server and 2008 server.
Does it mean it can not work on XP?
Or can i find any other APIs to do the same thing as NetValidPasswordPolicy?
I googled a lot for this issue and found someone had asked similar question but it went unanswered :(. So, here I am trying my luck.
Even I tried to analyze 'NETAPI32.dll' in Reflector.exe, but while opening the .dll file it error out: Object reference not set to an instance of an object.
I am stuck badly and could not able to find any way. Any help will be appreciated :)

Issue has been solved :).
NetValidPasswordPolicy API from 'NETAPI32.dll' has requirements that it is not 'client' supported. Because of this requirement I am getting the warning: Entry point not found.
I tried my project on Windows 2003 server and it worked.
And my second question about 'Reflector.exe' is also invalid because 'NETAPI32.dll' is not .Net dll so Reflector wont recognize it.

Related

Coded UI Test change user causes FatalExecutionEngineError returning a AgentRestart.dat

Issue:
I'm running a Coded UI Test with CUITe in VS 2012 Update in C#.
QA agent is falling over and producing a dat file
running in Debug mode
It successfully opens the IE browser window , logs in, attempts to change user in a combo box. the format for these names are 'Mr First Last (username)'
CUITe_HtmlComboBox cboUsers = bw.Get<HtmlComboBox>("Id~user");
string terminatingString = ")";
int i = -1;
foreach(string userPart in cboUsers.Items) //'Mr'
{
if(userPart.EndsWith(terminatingString))
{
if(userPart.Contains("username"))
cboUsers.SelectItem(i);
i++;
}
}
Logs
During debugging VS will throw this
FatalExecutionEngineError was detected
Message: The runtime has encountered a fatal error.
The address of the error was at 0x69c08d3b, on thread 0x1410.
The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code.
Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
Running through MSTest.exe there is a AgentRestart.dat as follows ( apologies for the
ÿÿÿÿ sMicrosoft.VisualStudio.QualityTools.AgentObject, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 7Microsoft.VisualStudio.TestTools.Agent.AgentRestartInfo m_runIdm_testsCompleted System.Guid ýÿÿÿSystem.Guid _a_b_c_d_e_f_g_h_i_j_k ÂTíÚi©D¹È›ë¤÷
I'm working through the Managed Debugging Assistants. As the debugging is done in the Test Explorer it may not get called. I've kept the code to a minimum, and will include more if needed
Found the answer, couldn't connect to the
telnet ip port for the data source

Graphics Server Documentation or User Guide

I got a very old Classic ASP code which is running on windows server 2003 the code has lines something like GSDSVR.GSServerProp and GSSERVER.GSServerProp. After some research I found that this is some kind of Graphic Server Component to generate chats or graphics, but I am unable to find any example on how to use it.
Block of code I have-
Set GSObject("Bar") = Server.CreateObject("GSDSVR.GSServerProp")
GSObject("Bar").URL = Graphics_URL
... more stuff ...
GSObject("Bar").Height = 291
GSObject("Bar").ClipGraph = 1
Tmp_FileName = GSObject("Bar").DrawGraph()
The code generates chart(s) based on some data, Now I want to achieve this using .net.
The problem I am facing is I don't know what is happening in code I just know the out of the code.
Can anyone please help me with documentation or few examples for this graphic server component?

EXCEL.EXE Running even after i use excelObj.Quit(); in activexscripts

Since, I could not find any satifying answer on the web for this question, I put forth it in Stackoverflow. I use activexscript to manipulate Excel, Outlook. But, even after I runexcelobj.Quit() at the end, I see an EXCEL.EXE still running in the task manager.
I tried using excelobj.Application.Quit() (as mentioned by some post in stackoverflow)also did not resolve the problem.
Can somebody help me with this??
Here's one way the application goes away in JScript:
// WScript.CreateObject for cscript.exe or wscript.exe
var excel = new ActiveXObject("Excel.Application");
// ...
excel.Quit();
// null out EVERY reference to Excel objects
excel = null;
CollectGarbage();

Error registering SharePoint WebDeleting event receiver in some environments

I am trying to register a WebDeleting event receiver within SharePoint. This works fine in my development environment, but not in several staging environments. The error I get back is "Value does not fall within the expected range.". Here is the code I use:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite elevatedSite = new SPSite(web.Site.ID))
{
using (SPWeb elevatedWeb = elevatedSite.OpenWeb(web.ID))
{
try
{
elevatedWeb.AllowUnsafeUpdates = true;
SPEventReceiverDefinition eventReceiver = elevatedWeb.EventReceivers.Add(new Guid(MyEventReciverId));
eventReceiver.Type = SPEventReceiverType.WebDeleting;
Type eventReceiverType = typeof(MyEventHandler);
eventReceiver.Assembly = eventReceiverType.Assembly.FullName;
eventReceiver.Class = eventReceiverType.FullName;
eventReceiver.Update();
elevatedWeb.AllowUnsafeUpdates = false;
}
catch (Exception ex)
{
// Do stuff...
}
}
}
});
I realize that I can do this through a feature element file (I am trying that approach now), but would prefer to use the above approach.
The errors I consistently get in the ULS logs are:
03/11/2010 17:16:57.34 w3wp.exe (0x09FC) 0x0A88 Windows SharePoint Services Database 6f8g Unexpected Unexpected query execution failure, error code 3621. Additional error information from SQL Server is included below. "The statement has been terminated." Query text (if available): "{?=call proc_InsertEventReceiver(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}"
03/11/2010 17:16:57.34 w3wp.exe (0x09FC) 0x0A88 Windows SharePoint Services General 8e2s Medium Unknown SPRequest error occurred. More information: 0x80070057
Any ideas?
UPDATE - Some interesting things I have learned...
I modified my code to do the following:
I call EventReceivers.Add() without the GUID since most examples I see do not do that
Gave the event receiver a Name and Sequence number since most examples I see do that
I deployed this change along with some extra trace statements that go to the ULS logs and after doing enough iisresets and clearing the GAC of my assembly, I started to see my new trace statements in the ULS logs and I no longer got the error!
So, I started to go back towards my original code to see what change exactly helped. I finally ended up with the original version in source control and it still worked :-S.
So the answer is clearly that it is some caching issue. However, when I was originally trying to get it to work I tried IISRESETs, restarting some SharePoint services OWSTimer (this, I believe runs the event hander, but probably isn't involved in the event registration where I am getting the error), and even a reboot to make sure no assembly caching was going on - and that did not help before.
The only thing I have to go on is maybe following steps such as:
Clear the GAC of the assembly that contains the registration code and event hander class.
Do an IISRESET.
Uninstall the WSP.
Do an IISRESET.
Install the WSP.
Do an IISRESET.
To get it working I never did a reboot or restarted SharePoint services, but I had done those prior to getting it working (before changing my code).
I suppose I could dig more with Reflector to see what I can find, but I believe you get to a dead end (unmanaged code) pretty quick. I wonder what could be holding on to the old DLL? I can't imagine that SQL Server would be in some way. Even so, a reboot would have fixed that (the entire farm, including SQL Server are on the same machine in this environment).
So, it appears that the whole problem was creating the event receiver by providing the GUID.
EventReceiverDefinition eventReceiver = elevatedWeb.EventReceivers.Add(new Guid(MyEventReciverId));
Now I am doing:
EventReceiverDefinition eventReceiver = elevatedWeb.EventReceivers.Add();
Unfortunately this means when I want to find out if the event is already registered, I must do something like the code below instead of a single one liner.
// Had to use the below instead of: web.EventReceivers[new Guid(MyEventReceiverId)]
private SPEventReceiverDefinition GetWebDeletingEventReceiver(SPWeb web)
{
Type eventReceiverType = typeof(MyEventHandler);
string eventReceiverAssembly = eventReceiverType.Assembly.FullName;
string eventReceiverClass = eventReceiverType.FullName;
SPEventReceiverDefinition eventReceiver = null;
foreach (SPEventReceiverDefinition eventReceiverIter in web.EventReceivers)
{
if (eventReceiverIter.Type == SPEventReceiverType.WebDeleting)
{
if (eventReceiverIter.Assembly == eventReceiverAssembly && eventReceiverIter.Class == eventReceiverClass)
{
eventReceiver = eventReceiverIter;
break;
}
}
}
return eventReceiver;
}
It's still not clear why things seemed to linger and require some cleanup (iisreset, reboots, etc.) so if anyone else has this problem keep that in mind.

sharepoint: Using a Content Editor Web Part this error occurred:"Cannot retrieve properties at this time."

I have a content editor web part. Whenever I edit the content and then click save, the following errors occurred:
"Cannot retrieve properties at this time."
"Cannot save your changes"
How do you fix this?
I tried googling it.. there are some similar cases but not exactly the same. I tried this link:
www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/MS-SharePoint/Q_21975446.html
and this one:
support.microsoft.com/kb/830342
and this one:
blogs.msdn.com/gyorgyh/archive/2009/03/04/troubleshooting-web-part-property-load-errors.aspx
I found the answer!! apparently using mozilla firefox it worked. Then I found out that there is a javascript error in IE, this javascript error doesnt happened in firefox. how ironic!
Are you doing anything to modify the URL in an HTTPModule? I ran into this problem on a publishing site where a module was hiding the "/pages" part of the URL. Modifying the CEWP via the page when accessed w/o the "/Pages" wasn't working, but with the "/Pages" it was.
Example:
Got error: http://www.tempura.org/webpartpage.aspx
Worked: http://www.tempuri.org/pages/webpartpage.aspx
I don't see how this is an answer -- "don't use IE".
In my case (and apparently many others) it has something to do with ISA + SharePoint + host headers. I will post the fix if I find one.
I have had problems with this before and have found recycling the Application Pool often corrects the problem.
Rodney
IE8 -->
Tools --> Compatiblity View Settings --> CHECK THIS : Display All Websites in ....
If you are editing a webpart page, make sure that it is checked out. Sometimes the document library the webpart pages are in will have a "force check out to edit" option and it will give you errors if the webpage itself isn't checked out.
I had this same error recently. In javascript, I had written some prototype overrides (see examples below) to add some custom functions to the string and array objects. Both of these overrides interferred with SharePoint's native JavaScript somehow in IE. I removed the references from the master page and this issue was FIXED. Currently trying to find a work-around so I can keep them because things like the string.format function is very nice to have...
//Trim
if (typeof String.prototype.trim !== 'function') {
String.prototype.trim = function(){
return this.replace(/^\s+|\s+$/g, '');
}
}
//Format
String.format = function() {
var s = arguments[0];
for (var i = 0; i < arguments.length - 1; i++) {
var reg = new RegExp("\\{" + i + "\\}", "gm");
s = s.replace(reg, arguments[i + 1]);
}
return s;
}
I also faced the same problem. Finally it worked for me using url /Pages/Contact-Us.aspx instead of clean URL. It worked only with IE browser. Don't know why this was happening but anyhow it worked with me.
Use IE browser
Use Pages in the URLinstead of clean URL.
to me,
compatibility mode in IE8, to work

Resources