473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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 3162
weaknessforcats
9,208 Expert Mod 8TB
// set privilege level
if (!AdjustTokenPrivileges(hToken, false,
&NewState, sizeof(TOKEN_PRIVILEGES), 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
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...
5
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...
8
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: ...
12
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
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...
3
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...
7
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....
22
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...
5
by: kenneth6 | last post by:
int Class::function() { if(a>b) { if(c==1) { if(d==2) { return 2; }
11
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.