Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

NULL NULL NULL NULL NULL NULL NULL NULL

Name: Anonymous 2007-05-16 14:19 ID:KsapqClV

// RemoveTSLicenses.cpp

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shlwapi.h>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;

char * program_name = "Remove TS Licenses"; // messagebox title

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    LONG error_code;
    stringstream error_message;

    // is the user sure they want to do this?
    if (IDYES==MessageBox(NULL, "This program will clear the Terminal Server licenses on this computer. Continue?", program_name, MB_YESNO))
    {
        HKEY hreg = NULL;

        // try opening the license store
        error_code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\MSLicensing\\Store", 0, KEY_READ, &hreg);
        if (ERROR_SUCCESS!=error_code)
        {
            // display error message upon failure
            error_message << "There was an error opening the license store! (error ROKE:" << error_code << ")";
            MessageBox(NULL, error_message.str().c_str(), program_name, MB_ICONERROR);
            return 1;
        }

        // get length of longest subkey name so we can allocate the correct sized buffer
        DWORD subkey_buffer_length;
        if (ERROR_SUCCESS!=(error_code=RegQueryInfoKey(hreg, NULL, NULL, NULL, NULL, &subkey_buffer_length, NULL, NULL, NULL, NULL, NULL, NULL)))
        {
            // display error message upon failure
            error_message << "There was an error reading information from the license store! (error RQIK:" << error_code << ")";
            MessageBox(NULL, error_message.str().c_str(), program_name, MB_ICONERROR);
            return 2;
        }
        subkey_buffer_length++; // +1 for terminating null
        char * subkey_buffer = new char[subkey_buffer_length];
        int subkeys_deleted;

        // enumerate subkeys (i.e. the licenses)
        for(subkeys_deleted=0;;subkeys_deleted++)
        {
            // we continually look for subkey zero as it renumbers them after each deletion
            error_code = RegEnumKey(hreg, 0, subkey_buffer, subkey_buffer_length);
            if (ERROR_NO_MORE_ITEMS==error_code) // no more licenses to delete, so exit loop
                break;
            if (ERROR_SUCCESS!=error_code)
            {
                // display error message upon failure
                error_message << "There was an error reading information from the license store! (error REKE:" << subkeys_deleted << ":" << error_code << ")";
                MessageBox(NULL, error_message.str().c_str(), program_name, MB_ICONERROR);

                return 3;
            }

            // delete the license we just found
            if (ERROR_SUCCESS!=(error_code = SHDeleteKey(hreg, subkey_buffer)))
            {
                // display error message upon failure
                error_message << "There was an error deleting a license from the license store! (error SHDK:" << subkey_buffer << ":" << error_code << ")";
                MessageBox(NULL, error_message.str().c_str(), program_name, MB_ICONERROR);
                return 4;
            }
        }

        // success!
        if (0==subkeys_deleted) // did we actually remove any?
        {
            MessageBox(NULL, "There were no licenses to remove!", program_name, MB_ICONINFORMATION);
        }
        else
        {
            MessageBox(NULL, "All licenses were removed successfully", program_name, MB_ICONINFORMATION);
        }
    }

    return 0;
}

Name: Anonymous 2007-05-16 18:41 ID:ns98HB0Q

in after NULL

Name: Anonymous 2007-05-16 18:52 ID:gaL/NeyG

I find the verbose nature of C++ coders far more annoying. You should also just compile with warnings instead of putting constants on the left side of comparisons.

Name: Anonymous 2007-05-17 5:43 ID:v4Wh9Z4V

You should also just compile with warnings instead of putting constants on the left side of comparisons.
Why?

Name: Anonymous 2007-05-17 6:25 ID:7UXp1b2D

It's like top posting.
You should also just compile with warnings instead of putting constants on the left side of comparisons.
Why?

Name: Anonymous 2007-05-17 7:00 ID:QSA/jWat

> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Why?

Name: Anonymous 2007-05-17 7:24 ID:/kQG++9W

>>4
C Forth is not Because.

Name: Anonymous 2007-05-17 7:29 ID:mg/M6mib

>>7
C Forth is not Because

Name: Anonymous 2007-05-17 9:41 ID:v4Wh9Z4V

>>5

In other words, perfectly fine but a vocal minority like to complain about it because they're dicks.

Name: Anonymous 2007-05-17 9:45 ID:phHIiXfm

>>9
If you consider top posting `perfectly fine', I hope you die horribly and soon.

Name: Anonymous 2007-05-17 9:46 ID:v4Wh9Z4V

>>10

Thanks for proving my point.

Name: Anonymous 2007-05-17 11:50 ID:kWDJBy5x

There's a special place in Hell for top posters, people who send HTML email/news and coders who write non-idiomatic code.  "0 == x" is not idiomatic, check out K&R.

Name: Anonymous 2007-05-17 12:09 ID:oN+hJM7k

>>12

I thought you said a special place in Haskell at first.

Name: Anonymous 2007-05-17 12:39 ID:QWYnadyF

>>12
Not that I disagree, but why use K&R as a style reference for any language but C? (Except to piss off people that force you to write Java.)

Name: Anonymous 2007-05-17 13:13 ID:v4Wh9Z4V

You guys are talking rubbish.

Firstly, putting the constant on the left avoids bugs from mistyping the equality operator as the assignment operator, simply because equality is symmetric but assignment isn't. Yes, I know most modern compilers will emit warnings but it hasn't always been that way.

And secondly, for code like this:

if (constant==very_long_function(with,lots,and,lots,and,lots,of,parameters) {
   ...
}


it makes sense to put the constant on the left because it's a lot more readable.

Name: Anonymous 2007-05-17 13:17 ID:Heaven

It makes sense to use whatever the fuck you want.

Name: Anonymous 2007-05-17 15:51 ID:U9C9Ude9

>>14

I mentioned K&R because >>7 was talking about C.  For C++ I'd tell people to write code the way it's printed in Stroustrup's TC++PL instead, Sun's style guide for Java, etc.

Name: Anonymous 2007-05-17 17:28 ID:irwIOCZd

Name: Anonymous 2007-05-17 17:46 ID:rY3V9UIJ

>>17
How's that related to the topic? Or it's just you way of saying "I've read K&R"?

Name: Anonymous 2007-05-17 17:55 ID:phHIiXfm

>>18
HA HA HA, oh wow.

Name: Anonymous 2007-05-17 21:13 ID:0nkJ7cZK

>>18

I lol'd

Name: Anonymous 2007-05-18 5:34 ID:8Ezvve8Q

>>18
What's even better is that none of these results are Win32. Ouch.

Name: Anonymous 2007-05-18 5:37 ID:m9638rmr

>>22
Because there are SO many FOSS programs for Win32...

Name: Anonymous 2007-05-18 6:14 ID:LZtBGqiM

Name: Anonymous 2007-05-18 12:04 ID:8Ezvve8Q

>>23
Truth, sorry. Still, I hope I could troll you a tiny bit.

Name: Anonymous 2007-05-19 14:43 ID:i5Z4REG7

>>24
Assigning null to array hardly counts as win. I'd say C is the winner: http://preview.tinyurl.com/34lldu

Name: Anonymous 2007-05-19 14:44 ID:i5Z4REG7

[cod€]
int parse_url(unsigned char *url, int *prlen, unsigned char **user, int *uslen, unsigned char **pass, int *palen, unsigned char **host, int *holen, unsigned char **port, int *polen, unsigned char **data, int *dalen, unsigned char **post)
[/code]

Name: Anonymous 2007-05-20 1:38 ID:Heaven

>[cod€]
what

Name: Anonymous 2009-03-06 7:15

if you pass around   the singleton then   you can actually   use to make   all of my   life in manuals   and documentation to   have a twat   like you asking   him to hax   someone else instead   of using the   famed SICP textbook.

Name: Anonymous 2010-12-06 9:14

Back to /b/, ``GNAA Faggot''

Name: Sgt.Kabu縆ﻂkiman͸൶ 2012-05-29 2:09

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Name: Anonymous 2013-05-23 21:06

\<a href="javascript:install_virus()"\>GOYS ONLY\</a\>

Name: Anonymous 2013-05-23 21:19

\\\\\\\\\\

Name: Anonymous 2013-05-23 21:19

[

Name: Anonymous 2013-05-23 21:20

[
[

Name: Anonymous 2013-05-23 21:20

\/
[

Name: Anonymous 2013-05-23 21:22

\]
[
\{
\}
\(
\)
\^
\&
\#
\n
\r
\a
\t

Name: Anonymous 2013-05-23 21:23

\%
\$
\@
\!
\.
[0,0;

Name: Anonymous 2013-05-23 21:25

\0
[[[\0;]]]

Name: Anonymous 2013-05-23 21:26

[[[\?;[%]/]]]

Don't change these.
Name: Email:
Entire Thread Thread List