|
Look at the PSS article 132958, entitled "HOWTO: Manage User Privileges Programmatically in Windows NT".
Essentially, it's a step-by-step guide to using the LSA (Local Storage Authority) subsystem, from LsaOpenPolicy(), LsaAddAccountRights() etc
In fact, it's exactly what you want, I suspect;
"This sample will grant the privilege SeServiceLogonRight to the account specified on argv[1]. "
Steve S
|
|
|
|
|
Yes, you are absolutely right.
I implemented it successfully.
thnx...
AK.
*******
|
|
|
|
|
As you said I implemented it and its working fine with WindowsNT, Windows2000 os. But it fails in WindowsXP. Again the same error: "Logon as Service right not given".
How to rectify it??
thnx...
AK.
********
|
|
|
|
|
Hi,
I was wrote a service, I want write an application to communicate with this service, I use Socket mechanism but when I start service it generate error.
Have you resolve for this problem?
Please help me.
Thank you .
L.H.Dung
|
|
|
|
|
What errors do you get?
Can your service start without the socket start listening?
Your question is ambiguous.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Anthony_Yio wrote:
Your question is ambiguous.
I wish there was a warning box or something that states that before posting only "I get an error" you should fully explain the error or no one will be able to help. I see this question every day on the forums...
John
|
|
|
|
|
What error? Is it a socket error? Or does the service not start? Did you call GetLastError to get the error code?
John
|
|
|
|
|
I have buld a static library and also a test program to check out the library.
However when I try and build my test program I get the warning:
: defaultlib 'LIBCD' conflicts with use of other libs; use /NODEFAULTLIB:library
I have place the line: /NODEFAULTLIB:WAPI_AIM.lib in the Ignore Specific Library option of the Linker properties, but still get the warning. Note WAPI_AIM.LIB is my libray.
I would like to clear this warning.
Any suggestions?
|
|
|
|
|
Use __AFXWIN_H__ instead of _AFXDLL to determine MFC presence.
its nested in
#ifdef _AFXDLL
#endif
(found somewhere)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Cant find any reference to _AFXDLL;
only this code below:
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
|
|
|
|
|
Do you have a mixture of static and dll based MFC?
This could lead to the symtoms you are describing.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Yes. I have developed a static library on top of a 3rd party API, which uses DLLs.
The reason for the static library is to remove the single source dependance on a single supplier.
Is this the problem and can it be resolved?
|
|
|
|
|
AFAIK you can nor link the MFC statically and per DLL at the same time.
When your app statically links MFC and also links a library that in turn dynamically links the MFC, you are in trouble. I do not know a way to solve this problem. But that does not mean ther is no way.
What I always did was changing the setting for one or the other.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Did you try /NODEFAULTLIB:LIBCD ?
John
|
|
|
|
|
Under what linker option do I place this setting?
|
|
|
|
|
If you are using VC6 under the link tab (in project settings) if yo go to the input category and put LIBCD in the ignore libraries the compiler will put it in the linker options for you. You will see a line in the Project Options box at the bottom of the dialog that states /nodefaultlib:"LIBCD"
John
|
|
|
|
|
I place the option under Ignore Specific Library and still get the warning.
|
|
|
|
|
I'm sorry if I am wasting your time. In the past that has always worked for me. Try adding a .lib so the entry is LIBCD.LIB. Is there any other libraries listed in the box? If so you must seperate them with a comma.
John
|
|
|
|
|
Just to recap. I am creating a Static Libray which uses calls to a 3rd party API.
I have a test program, Windows Dialog MFC application and has the option set 'Use MFC in a Shared DLL'
in the Ignore Specif Library is set to:
/NODEFAULTLIB:WAPI_AIM.LIB;api_mil.lib
Where api_mil.lib is the 3rd party library and WAPI_AIM.LIB is my static library.
|
|
|
|
|
sweep123 wrote:
the Ignore Specif Library
You are using Visual C++.Net? I use VC6 but also have a copy of Visual Stusio.NET.
I believe that you should put in the Ignore Specific Library box only LIBCD.LIB and nothing else. And you should never put /NODEFAULTLIB: in that box. If you need to ignore other libraries seperate the list with semicolons. If you look at the command line tab you will see excatly what command that visual studio is generating for the /NODEFAULTLIB: parameter.
John
|
|
|
|
|
I am using Visual Studio .Net.
I did place WAPI_AIM.LIB in the Ignore Library Option, but still get the same warning.
|
|
|
|
|
You do not want to ignore WAPI_AIM.LIB or api_mil.lib
because that is what you are linking with. This statement tells the linker not to use these libraries. You want to ignore LIBCD.LIB instead because that is the one causing the problem.
John
|
|
|
|
|
OK got it.
Thanks, the warning has now gone.
|
|
|
|
|
Glad to be of help..
John
|
|
|
|
|
i am using a visual studio add in.
in one of the methods i am using
CWinApp* pApp = AfxGetApp();
i need to get a pointer the visual studio app, not the add in app,
in both cases, even if i use or don't use AFX_MANAGE_STATE(AfxGetStaticModuleState()); i get a pointer to the add in app
and not the pointer to the visual studio (exe)
how can i retrieve the pointer to the visual studio exe???
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|