473,789 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ERROR (C++): 'main' : not all control paths return a value

1 New Member
Expand|Select|Wrap|Line Numbers
  1. /*Windows Privilage Grant...*/
  2. #include "H:\Profile\Desktop\rawrr\HEADERS.h"
  3. #include "H:\Profile\Desktop\rawrr\DEFINITIONS.h"
  4.  
  5. HANDLE screen;
  6.  
  7. int main ()
  8. {
  9.     TOKEN_PRIVILEGES NewState; //granting privileges to shut off Windows© Firewall among other things...
  10.     LUID_AND_ATTRIBUTES luidattr;
  11.     HANDLE hToken;
  12.     LUID tmpLuid;
  13.  
  14.     DWORD dwVersion = GetVersion();
  15.     if ( dwVersion < 0x80000000)
  16.     {
  17.         // Windows NT4/2000/XP
  18.         HANDLE handleProcess=GetCurrentProcess();
  19.  
  20.         // get a token handle
  21.         if (!OpenProcessToken (handleProcess,
  22.                 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
  23.         return 0;
  24.  
  25.         //program requires admin rights to run
  26.         if (!LookupPrivilegeValue(0, SE_SHUTDOWN_NAME, &tmpLuid))
  27.         return 0;
  28.  
  29.          NewState.PrivilegeCount = 1;
  30.          luidattr.Luid=tmpLuid;
  31.          luidattr.Attributes=SE_PRIVILEGE_ENABLED;
  32.          NewState.Privileges[0]=luidattr;
  33.     }
  34.  
  35.          // set privilege level
  36.          if (!AdjustTokenPrivileges(hToken, false,
  37.                  &NewState, sizeof(TOKEN_PRIVILEGES), 0, 0))
  38.          return EXIT_SUCCESS;
  39. }
  40.  
Help :P
Mar 26 '10 #1
1 3197
weaknessforcats
9,208 Recognized Expert Moderator Expert
// set privilege level
if (!AdjustTokenPr ivileges(hToken , false,
&NewState, sizeof(TOKEN_PR IVILEGES), 0, 0))
return EXIT_SUCCESS;
} // end of main
What is returned if this if statement is false?
Mar 26 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5040
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I double-checked the path to my error log. It is in /var/www/logs/php_error_log Thanks. :) -Wayne Stevenson
5
16260
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information Server might not be running or the path exists and is redirected to another machine. Please check the status of this virtual directory in the Internet Services Manager."
8
4066
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: DoCmd.SetWarnings False DoCmd.RunCommand acCmdDeleteRecord DoCmd.SetWarnings True End If ExitHere: Me!SubName.SetFocus
12
4133
by: Jose Fernandez | last post by:
Hello. I'm building a web service and I get this error. NEWS.News.CoverNews(string)': not all code paths return a value This is the WebMethod public SqlDataReader CoverNews(string Sport) {
4
13012
by: OutdoorGuy | last post by:
Greetings, I am attempting to compile the code below, but I am receiving an error message when I do so. The error message is: "CSO161: 'Forloop.CalcAvg(int)': Not all code paths return a value". Any idea as to what I'm doing wrong? I'm sure it's something simple. Thanks in advance! public class ForLoop
3
8645
by: Oberon | last post by:
How do I deal with this? I am getting an error for each get in the Game class (see code below). In the simplified example below I have reduced this to just 3 fields, one which can be NULL. I have added 3 records to the table and ran the program but it fails with the error above. The application is supposed to create the hashtable of records as a static feature which will be permanently available to my application. To demonstrate that...
7
5026
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying. I created the websetup and built the MSI, have the bundled version. Copied to webserver and ran Websetup.msi. Said I had to remove old version, which I did, then reran WebSetup.msi and keeps giving me this error. "The installer was interrupted...
22
3280
by: Amali | last post by:
I'm newdie in c programming. this is my first project in programming. I have to write a program for a airline reservation. this is what i have done yet. but when it runs it shows the number of seats as 0 and the flight no. is also repeating. If any can tell why is this please help me. #include<stdio.h> #include<ctype.h> #include<conio.h>
5
11877
by: kenneth6 | last post by:
int Class::function() { if(a>b) { if(c==1) { if(d==2) { return 2; }
11
5597
by: xenoix | last post by:
hey there, im reasonably new to C# and im currently writing a backup application which im using as a learning resource. My PC :- Visual Studio 2005 .NET Framework 2 Component Factory Krypton Tools Test PC :- .Net Framework 2
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6765
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.