Visual C++ :: Running / Debugging Console App That Needs Admin Privileges
Nov 4, 2012
I see there's something called a manifest file but VS C++ EXPRESS seems different than non-express. The solutions I've seen show applets/tabs that I don't have in Express.
In one of my physical DEBUG folders are some .manifest. files and some a .res and .rc file.
I know you need to edit the XML and change asInvoker to requiredAdministrator (or something like that).
The confusing part is if I go into Project Properties, MANIFEST TOOL caret/tree, under INPUT AND OUTPUT, it shows this .manifest file is OUTPUT. It's as if it rewrites it every time with some defaults? I have edited it, but I see it's back to asInvoker. There is a spot to put in a ADDITIONAL manifest file (or .res file).
Does a manifest somehow affect the physical .exe file (something is imbedded in it??)?
How do I change my project to make sure that the .exe always runs as Admin? Will doing this ALSO allow me to DEBUG it in VS C++ EXPRESS without having to do anything different (play with manifest or run VS outright with Admin level)?
View 2 Replies
ADVERTISEMENT
Mar 12, 2013
I want to create a text-based game with C++, running on the console. I have made some other text-based console games.
Which is the most interesting text-based game to learn how to program for beginners?
View 2 Replies
View Related
May 24, 2014
For my purpose all I need to know is drive's BitLocker encryption status by its DOS path. Something like this:
Code:
enum DriveEncryptionStatus{
Unprotected,
Protected,
Unknown
};
DriveEncryptionStatus = GetDriveBitlockerEncryptionStatus(L"C:");
I was able to find the Win32_EncryptableVolume class that unfortunately comes with this caveat:
To use the Win32_EncryptableVolume methods, the following conditions must be met:
You must have administrator privileges.
How to do this without running as an administrator?
View 4 Replies
View Related
Dec 9, 2014
I'm trying to write to a named pipe created by a service, as we all know the session 0 isolation implemented in vista and forward makes this task a bit complicated.
well at this point i managed to make almost all to work but my real problem comes when i try to write on the named pipe from my GUI application with no administrator rights
If i run the GUI application with admin rights it works 100% but, I don't need that application to require the user admin rights and for security reasons i rather to leave it without admin...
so i started my research and i found that there is a way to achieve this by calling CreateNamedPipe() with a low integrity security attributes...
well how to implement but i finally made it, the problem is that it gets worse than passing null security attributes, it works with admin rights with NULL security attributes, but when i pass the low integrity security attributes it gives "access denied" even when using admin rights, so i guess im passing the wrong security attributes but how to manually create the security descriptor string.
This is the code:
Service (session0) SERVER
Code:
DWORD WINAPI PipeThreadRSVS(void* pParameter){
LPTSTR _PIPE_NAME = "\.pipeRSVHPipeIn";
bool Break=false;
char Received_Buffer[BlockSize+16];
DWORD BytesRead = 0;
[Code] ....
View 2 Replies
View Related
Oct 31, 2013
When running my code in Visual Studio, there is a particular point in the code where my program is crashing. To debug this, I am adding a break point in Debug mode just before that point, and observing what happens as I step through the code. However, to get to this break point in the code takes about a minute of running the program. So I'm wondering if there is a tool in Visual Studio to reload the state of a program's memory from a previous run, so that I can immediately get to the break point without having to wait for a minute each time?
View 6 Replies
View Related
May 10, 2014
I am making a MFC application with VC++2012 with receiving data from Serial Port and the data is stored in a Listbox, then after processing (convert into numbers) and get these data to draw a sine wave on the chart. (I intend to make a virtual oscilloscope).
Everything works ok at the beginning, but after receiving about 300 items or above (in the Listbox) the value seem stucking (or lagging) and work very slowly.
I receive data by the SerialPort_DataReceived() method, and process of converting and drawing chart also in this method, I think this makes the system overload!!
View 1 Replies
View Related
Aug 12, 2013
I have a crash on a application the customer machine i couldn't reproduce it yet on my machine... all i have is the error message
The Instruction 0x0070478b referencing to the memory 0x00000000 could not be written.
And that's all i have how do i track that instruction on my program from that address? is it possible?
View 4 Replies
View Related
Dec 20, 2012
I am debugging a library. I can step into the code however the watch window doesn't show the values of any variables. It will display a message in the value field:
Code:
m_pParentCXX0017: Error: symbol "m_pParent" not found
Interestingly it does show values for local variables in that function but not member functions. Most of my data members are member function though that I want to debug. I am using VS2010.
View 3 Replies
View Related
Apr 22, 2013
i created a windows service that will run another program. but the program i want to run has a gui and i don't want the gui to be visible, i just want the program to run in the background.
But i have to do it without editing the gui program
here's my code:
Code:
TCHAR* path = L"C:Myfile est.exe";
STARTUPINFO info = {0};
PROCESS_INFORMATION processInfo;
ZeroMemory( &info, sizeof(info) );
info.cb = sizeof(info);
[code]....
i tested this code with notepad and it runs notepad in the background without displaying the window but when i try run my program it doesn't work. i don't know why its works for one program and not the other..
View 14 Replies
View Related
Aug 30, 2013
I would like to programmatically monitor a directory for new files, and if the file happens to be an executable, I want to prevent it from running. Something like a AV program.
However, I don't know where to start. Simple is best.
View 9 Replies
View Related
Jan 20, 2014
For my project I need to check whether my application instance is already running or not. I got the following code from Net ..
Code :
HANDLE mutex;
mutex = CreateMutex( NULL, TRUE, _T("MYAPPNAME"));
if ( GetLastError() == ERROR_ALREADY_EXISTS ) {
// There's another instance running. What do you do?
AfxMessageBox(_T("Application Already Exists"));
PostQuitMessage(0);
ExitThread(0);
return;
}
The code works fine .. but the code even works fine , even if I pass any string as a parameter to CreateMutex. E.g.
mutex = CreateMutex( NULL, TRUE, _T("QQQQ"));
How it is working fine ?
View 5 Replies
View Related
May 2, 2013
No I definitely used Visual Studio Command Prompt
c:Program FilesMicrosoft Visual Studio 9.0VC
un_process_from_service>make.bat
View 7 Replies
View Related
Feb 28, 2013
I am stuck on an exercise where i am supposed to use a loop to take user input and keep a running sum until the user enters a 0. the code i have so far is:
#include <iostream>
int main() {
using namespace std;
int num;
int total = 0;
int x;
[Code] ....
The full text of the error message is: error c2678:binary'>>':no operator found which takes a left-hand operand of type 'std::istream' . and one more thing i was wondering, is there a difference between c++ and visual c++?
View 4 Replies
View Related
Apr 25, 2014
I am encountering a problem on retrieving the Window Proc of a window that running in a process with another user.
For example, I have logon windows with domainuser1, and run the following command as:
runas /profile /env /user:domainuser2 C:WindowsSystem32calc.exe
And then the Calculator is shown in domainuser1 desktop, but the process is running in domainuser2 account.
When running Spy++ (either wither domainuser1 or domainuser2) to view the calculator window, the Windoe Proc field is shown 'Unavailable' I also try to call GetWindowLong against this window, it will always returns NULL.
I am just wondering if it is possible to retrieve the Window Proc of the window running in a process of another account, is is possible?
View 9 Replies
View Related
Jun 26, 2013
What I want to do is have an admin class which will hold all the employee objects, can add them, list and calculate salaries. I'm trying to make array of objects, not sure if it's right
here is the code
Code: #include <iostream>
#include <string>
using namespace std;
class Employee {
public:
Employee(string name, short type, int salary)
[Code] .....
View 2 Replies
View Related
Feb 2, 2014
How to compare the username and password entered by user with the data(username and password saved in before) in the admin array and customer array,
so for example when it match the username and password in the admin array, it will directs the user to the admin_mainmenu(), otherwise it directs to the customer_mainmenu().
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
char username_admin[10];
char password_admin[10];
[Code] ....
View 1 Replies
View Related
Feb 2, 2014
How to compare the username and password entered by user with the data(username and password saved in before) in the admin array and customer array,
so for example when it match the username and password in the admin array, it will directs the user to the admin_mainmenu(), otherwise it directs to the customer_mainmenu().
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
char username_admin[10];
char password_admin[10];
[Code] ....
View 2 Replies
View Related
Feb 7, 2013
I have a question about to run an MFC dialog based C++ application from console: if I run my application from console, I see the application start and the console immediately back to prompt. I need that console wait the application exit before show me the prompt again. I tried on Visual Studio 6, 2005 and 2010 but the behavior is the same.
View 3 Replies
View Related
Nov 15, 2013
I have a C++/MFC application that displays a count in a window:
The count (text) is displayed via a `CStatic` control. The mechanism is very simple. I call it every 1000 ms and update the text as such:
Code:
void CTestCountdownFlickerDlg::RedrawCounter(LPCTSTR pText)
{
CStatic* pTxtBox = (CStatic*)this->GetDlgItem(IDC_STATIC_COUNTER);
ASSERT(pTxtBox);
[Code]....
What happens is that the `CStatic` control updates without any issues on the OS with visual themes enabled, but if I run it on the OS with the Windows Classic theme (for instance, the screenshot above is from Windows 7) the `CStatic` control produces a visible flicker every time it updates the text.
Well, I understand that I'm nitpicking here, still I would really like to get rid of this flicker.
Here's what I tried:
1. In my actual project I tried subclassing the `CStatic` control and removed the processing of `WM_ERASEBACKGROUND` by simply returning 1. That didn't work.
2. In the same subclass for `CStatic` control I tried to override `WM_PAINT`, but that didn't work at all. So I'm not sure if I'm going too far with it at this point.
I'm attaching the C++/MFC source code for my test project .....
View 14 Replies
View Related
Jan 21, 2013
How can I check if window media player is running in full screen mode & topmost in c++ MFC?
What I used is this logic:
I compared media player full screen coordinates to that of monitor coordinates.If they are same implies media player is in fullscreen.But it has one flaw.Whenever there are control(for play,pause) displayed in full screen in media player, coordinates are not coming same as that of monitor.
View 10 Replies
View Related
Oct 31, 2014
Is it possible to show a console window in a Win32 DLL?
View 3 Replies
View Related
Dec 17, 2013
I have this function and it works, the problem is that it couts a bunch of stuff that I don't need. What this functions does asks the user to input a job (show) and if the show is found to list all the talents (actors/actresses). If the show is not found, to print "show not found". I have the function working just need to present it better. What I want the function to do is just print "show not found" and nothing else. How I have it currently will print:
Notice how its outputting all the unnecessary information. If the job is found should look like this:
Uploaded with ImageShack.us
Code:
void TalentsByJob(Agency Talents[], int limit) {
system("CLS");
string show;
cout << "Enter the Job: ";
cin >> show;
bool found = false;
[code].....
View 14 Replies
View Related
Nov 22, 2012
I have to write tic-tac-toe game in Visual 2010. My only problem is that I don't know how I can move the cursor with arrows in the console in order to fill in chosen positions in 3x3 table:
Code:
_ _ _
_ _ _
_ _ _
I guess that the needed functions are in here: [URL] ....
but I don't know from what to start with...
View 1 Replies
View Related
Nov 23, 2013
I program a software to get scores from admin and sort them ascending then show the middle score(if admin enter middle).but when i compile it nothing happen.what should i do?here's code ,i use dev compiler
Code:
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
int main(int argc, char *argv[]) {
int counter,j,count,counter2,m;
[Code] ....
View 14 Replies
View Related
Feb 6, 2014
I used to use OutputDebugString, and not using it now because it only allows to strings to be outputted, are there any methods that I can dump virtually anything to the console?
cout << thing << endl;
But what if I am not start running the program from the command prompt?
View 2 Replies
View Related
Oct 11, 2013
I'm trying to write a program that passes Windows messages back and forth from another program that controls a laboratory instrument. I was able to write a program that successfully passes instructions, as evidenced by the instrument doing what I tell it. However, I am having trouble getting a return status from the instrument. The manual instructs the following:
// demo code, etc.
// send message to the instrument operating software here...
SendMessage(hwnd, WM_COPYDATA, tag, (LPARAM) &cd)
Either a completion message or return data is returned. Remote commands ReturnStatus, ReturnTiming, and ReturnData return data. In either case, data is received through an asynchronous windows message inside Win32 COPYDATASTRUCT type data packet.For example, a typical OnCopyData window callback is shown below, where the string data retrieved is finally stored into a Microsoft CString object. Note the use of variable replyTag, discussed above, which is used to isolate the correct windows message returned.
BOOL CUserDlg::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* cd) {
….
if (cd->dwData == replyTag) {
/* String pointing to status */
CString retStatus = (char*) cd->lpData;
}
….
}
I can't tell if my problem is in generating the replyTag, getting the HWND to my own console window, or the actual receiving part of the code.
When setting the replyTag, the manual instructs: UINT replyTag = RegisterWindowMessage(“SOFTMaxProReplyMsg”);. However, I have to put an "L" in front of the string or I get a data type error (can't convert const char* to LPCWSTR).
When setting a HWND for myself, the manual instructs: HWND MyWnd = GetSafeHwnd().
That produces an error because GetSafeHwnd is a function of the Cwnd class, and I don't have a Cwnd. I have replaced it with HWND MyWnd = GetConsoleWindow();
When listening for the reply message, the manual instructs what I quoted above. However, I again don't have a Cwnd. I therefore simply used
if (cd.dwData == replyTag) {
CString retStatus = (char*) cd.lpData;
}
The above if statement always evaluates false, and the cd.lpdata contains the message that I had sent out instead of a reply message. How to get a reply using my console application. Here is the full code of my function:
Code:
#include "stdafx.h"
#include<iostream>
#include<vector>
#include<string>
#include<afxwin.h>
using namespace std;
void SendCommand(string command) {
// Get tags to identify the receiving and sending messages
[code]....
View 3 Replies
View Related