|
Huh?
|
|
|
|
|
Somebody una-voted you on your answer above.
|
|
|
|
|
I dont see how it was useless though...
|
|
|
|
|
Neither do I, now go Google 'sarcasm'.
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Hi guyz!.. i'm trying to launch an application from a service with an elevated right. THe application actually needs admin rights to lock folders and read processes on the system. The code i tried to compose works when the active session is 0 but when I lock the account under session 0 and login into another session, it launches the application on the previous account, seeing the launch program after going back to the previous account. How can i Solve this problem?.
Here is my function using createprocessasuser()
******************************************************
IntPtr l_ptrBuffer = IntPtr.Zero;
int errorCode = 0;
bool ret;
IntPtr token = new IntPtr(0);
IntPtr dupedToken = new IntPtr(0);
UInt32 dwSessionID;
SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES();
sa.bInheritHandle = false;
sa.Length = Marshal.SizeOf(sa);
sa.lpSecurityDescriptor = (IntPtr)0;
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
STARTUPINFO si = new STARTUPINFO();
si.cb = Marshal.SizeOf(si);
si.lpDesktop = "winsta0\\default";
si.dwFlags = STARTF.STARTF_USESHOWWINDOW;
si.wShowWindow = ShowWindow.SW_SHOW;
this.writetolog("token b4:" + token);
dwSessionID = WTSGetActiveConsoleSessionId();
this.writetolog("from exe: " + dwSessionID.ToString());
WTS_INFO_CLASS.WTSUserName, out l_ptrBuffer, out l_nBytes);
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_SESSIONID, out token))
{
this.writetolog("dili successful pag openprocesstoken");
}
this.writetolog("token mid:" + token + "current process: " + GetCurrentProcess());
const uint GENERIC_ALL = 0x10000000;
const int SecurityImpersonation = 2;
const int TokenType = 1;
ret = DuplicateTokenEx(token, GENERIC_ALL, ref sa, SecurityImpersonation, TokenType, out dupedToken);
if (ret == false)
{
this.writetolog("dili successful pag duplic8");
}
this.writetolog("duptoken b4:" + dupedToken);
SetTokenInformation(dupedToken, TOKEN_INFORMATION_CLASS.TokenSessionId, dwSessionID, (uint)IntPtr.Size);
CloseHandle(token);
ImpersonateLoggedOnUser(dupedToken);
ret = CreateProcessAsUser(dupedToken,
executable,
cmdLine,
ref sa,
ref sa,
false,
0,
(IntPtr)0,
null,
ref si,
out pi);
if (ret == false)
{
this.writetolog("ala ka create og process");
}
if (WaitForSingleObject(pi.hProcess, timeOut) != 0)
{
}
uint ec;
GetExitCodeProcess(pi.hProcess, out ec);
errorCode = (int)ec;
RevertToSelf();
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
CloseHandle(dupedToken);
return errorCode;
******************************************************
Please help me guyz. Thankz
|
|
|
|
|
in the settokenifromation part..... an error occured (memory access is invalid). I think the calling process does not have enough acces riths to this. BUt the service is running with a LOCALSYSTEM rights. PLease Help me guyz..
Thankz..
|
|
|
|
|
I would like to open a new e-mail with an attachment in the default e-mail program, similar to the functionality in WinZip's context menu. I can open a new e-mail, but I can't make it recognize the attachment. Anyone know how to do this?
|
|
|
|
|
|
I can confirm that they will disregard the attachment when using the mailto: link. This is the way that I have been trying to use. But it must be possible somehow. WinZip and several other archivers are able to do Zip and e-mail, so it must be possible.
|
|
|
|
|
Edit: Good morning!
It looks like the mystery is solved. When we started testing, we also deactivated the firewall and virus protection to assure that they don't interfere with the test. Now it appears that deactivating them was not enough. Nothing short from completely uninstalling the virus protection stopped it from terminatinhg my thread. There was no log and no notification whatsoever. This thing, supposedly inactive, simply determined that this application is unwanted and terminated the thread as soon as it tried to do it's job.
At least the honor of Win XP is now restored.
I have a strange problem with a small application I am working on.
Basically the application (for testing this is a simple console application) starts a new thread to receive and analyze mail messages and then send faxes to certain receivers in response.
The the thread processes incoming mails, parses them, creates new messages and sends those as faxes to the receivers. After that it goes to sleep for a few minutes and does the same in an endless loop. The loop can only be broken when a ThreadAbortException is received. Then all cleanup is performed and the thread terminates.
The whole thing is a little longer, so it makes no sense to post some code here. Also, all this works just fine on my development machine with Windows Vista and VisualStudio 2008.
Edit: Sorry, I forgot to mention that the application uses the framework 2.0
Now the puzzling part: When installed on a Win XP machine, practically every call to the framework is answered by a ThreadAbortException. Catching and ignoring it will change nothing. The exception comes when trying to connect to the POP3 mailserver, when reading a small XML configuration file, when trying to send the faxes...
Generally it looks like the framework under Win XP is constantly trying to kill my thread for unknown reasons. Also, strange enough, of all things Vista seems to have no problem with the thread.
Does anyone know what this is?
Edit: I have logged one of the cases when the exception pops up. The same happens at practically any other location from different methods, always from within the framework. In this case it's while trying the XML configuration:
Montag, 26. Mai 2008, 13:34:25
Allgemeiner Fehler in cFaxClientRAL
Thread was being aborted.
at System.Globalization.CompareInfo.CompareRegion(Void* pSortingTable, Int32 sortingLCID, String string1, Int32 offset1, Int32 length1, String string2, Int32 offset2, Int32 length2, CompareOptions options) Now why would this method try to kill my thread?
at System.Globalization.CompareInfo.Compare(String string1, Int32 offset1, Int32 length1, String string2, Int32 offset2, Int32 length2, CompareOptions options)
at System.Data.DataTable.Compare(String s1, String s2)
at System.Data.Common.StringStorage.Compare(Int32 recordNo1, Int32 recordNo2)
at System.Data.Index.CompareRecords(Int32 record1, Int32 record2)
at System.Data.Index.IndexTree.CompareNode(Int32 record1, Int32 record2)
at System.Data.RBTree`1.RBInsert(Int32 root_id, Int32 x_id, Int32 mainTreeNodeID, Int32 position, Boolean append)
at System.Data.Index.InsertRecord(Int32 record, Boolean fireEvent)
at System.Data.Index.ApplyChangeAction(Int32 record, Int32 action, Int32 changeRecord)
at System.Data.DataTable.RecordStateChanged(Int32 record1, DataViewRowState oldState1, DataViewRowState newState1, Int32 record2, DataViewRowState oldState2, DataViewRowState newState2)
at System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Int32 position, Boolean fireEvent, Exception& deferredException)
at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, Int32 pos, Boolean fireEvent)
at System.Data.XmlDataLoader.LoadTable(DataTable table, Boolean isNested)
at System.Data.XmlDataLoader.LoadData(XmlReader reader)
at System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
at System.Data.DataSet.ReadXml(String fileName)
at Lymez.FaxServiceModule.RAL.cFaxServiceRAL.FaxClient_GetList()
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
modified on Tuesday, May 27, 2008 3:44 AM
|
|
|
|
|
I suspect your Fax library needs a window handle to work.
|
|
|
|
|
I don't think so.
The issues between worker threads and the user interface are well known. The thread has no user interface at all. Receiving mails is done around sockets, reading the configuration basically is a call to DataSet.ReadXml() method and sending the faxes uses a COM-wrapper. All of this is held together by a parser and some routines to reassemble the parsed mails into new fax messages. There is nothing remotely like a user interface nearby.
Also, the thread is always being killed, even if it just checks the mailbox and finds nothing to process. Even trying to read the xml configuration results in the thread being aborted, long before ever trying to send a fax.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
It was worth a guess
I am not sure what the issue would be. Here are some hints.
Try enable exceptions to be 'breaked' when throw in VS (Debug/Exceptions). The code from within ReadXml() could have some catch all scenario, and it is hiding the real exception. This can be seen too when throwing an exception from your comparer while doing an Array.Sort() .
|
|
|
|
|
I think we have it. It looks like the framework and Win XP are totally innocent. The virus protection was the culprit, even when it was supposed to be inactive. It valiantly protected us from our own application without any notice or log.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
Could you please tell us which AV product caused this trouble?
Let me guess - Norton?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Indeed, Norton.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
Muahaha! I so knew it!
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
When running our program as a single-threaded application, the AV was not able to to terminate it. It only shot down separate threads. What kind of security is this? Why is a single-threaded application less of a threat than a multi-threaded one? And why is this thing still active when the whole protection has been deactivated explicitly?
I guess all AV products can get on one's nerves once in a while. And also I can understand that an automated detection of potentially harmful activities may make a mistake here and there. Receiving mails, reading and writing XML and sending faxes, all in one thread may be interpreted as potentially harmful. But still I would at least have appreciated a message about what the AV protection intends to do or had done.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
modified on Wednesday, May 28, 2008 4:25 AM
|
|
|
|
|
I haven't had a real problem with any other AV software (apart from a false positive from Avira once) except Norton.
At a customer's I was installing .NET Framework 1.1 a while ago. Hundreds of times this went without troubles, but on this computer, the setup would simply hang without any notification whatsoever. Then I discovered that the customer had Norton InSecure Internet Security installed. Only wiping this crap from the disk completely allowed us to install .NET.
Seems as if Norton didn't get any better since then...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I am querying like below
SELECT XMLData.query('"title"') FROM XMLTable
on an sql server database's xmlTable's XMLData of xmltype field.
But it alway returning the string "title" for all the records in the table.
Is it not possible to query like the above ?
Please suggest something.
|
|
|
|
|
i've never used sql server xml functionality, but it looks like you're using wrong syntax.
execution the xpath "'title'" will always return "title", so you may need to modify your xpath expression.
what's a sample content of your xmltype field?
|
|
|
|
|
Actually i want to search the string "title" at any location through out the complete xml data. what is the way to frame the query?
Plese help.
|
|
|
|
|
so there is some xml data with 0, 1 or more occurances of "title" anywhere? okay..but what do you expect your query to return?
|
|
|
|
|
Hi all,
I am trying to use logging application block to log messages. I have to specify a user defined category on which events have to be logged. By default it's coming in the category "none" irrespective of the category we supplied. How to correct this?
Isn't there any relation between the category of the eventviewer and the category property of the logentry.
Should we have to play with registry for doing this?
Thanks in advance.
modified on Monday, May 26, 2008 10:24 AM
|
|
|
|
|
|