Skip to content

Commit

Permalink
1.151009
Browse files Browse the repository at this point in the history
remooved pthread.dll
  • Loading branch information
Blagodarenko authored and Blagodarenko committed Oct 9, 2015
1 parent 9c6e2c2 commit 38ea2f0
Show file tree
Hide file tree
Showing 7 changed files with 1,269 additions and 1,307 deletions.
2 changes: 1 addition & 1 deletion InstructionSet.h
@@ -1,6 +1,6 @@
#pragma once

#include <vector>

#include <bitset>
#include <array>
#include <string>
Expand Down
62 changes: 61 additions & 1 deletion PurgeStandbyList.cpp
@@ -1,3 +1,6 @@
// Î÷èñòêà ïàìÿòè îò ïðåáóôåðèçîâàííîé ÷àñòè ïðî÷èòàííûõ ôàéëîâ
//Ïðè êîìïèëÿöèè íàäî â ñâîéñòâàõ ëèíêîâùèêà äîáàâèòü /MANIFESTUAC:NO /level = "highestAvailable"

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
Expand Down Expand Up @@ -36,7 +39,9 @@ BOOL GetPrivilege(HANDLE TokenHandle, LPCSTR lpName, int flags)
tpNewState.PrivilegeCount = 1;
tpNewState.Privileges[0].Luid = luid;
tpNewState.Privileges[0].Attributes = 0;
bResult = AdjustTokenPrivileges(TokenHandle, 0, &tpNewState, (LPBYTE)&(tpNewState.Privileges[1]) - (LPBYTE)&tpNewState, &tpPreviousState, &dwBufferLength);
//bResult = AdjustTokenPrivileges(TokenHandle, 0, &tpNewState, (LPBYTE)&(tpNewState.Privileges[1]) - (LPBYTE)&tpNewState, &tpPreviousState, &dwBufferLength);
bResult = AdjustTokenPrivileges(TokenHandle, 0, &tpNewState, sizeof(TOKEN_PRIVILEGES), &tpPreviousState, &dwBufferLength);

if (bResult)
{
tpPreviousState.PrivilegeCount = 1;
Expand All @@ -47,6 +52,61 @@ BOOL GetPrivilege(HANDLE TokenHandle, LPCSTR lpName, int flags)
}
return bResult;
}

NTSTATUS ClearMem(void)
{

HANDLE hProcess = GetCurrentProcess();
HANDLE hToken;
if (!OpenProcessToken(hProcess, TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &hToken))
{
fprintf(stderr, "\nCan't open current process token\n");
return 0;
}

if (!GetPrivilege(hToken, "SeProfileSingleProcessPrivilege", 1))
{
fprintf(stderr, "\nCan't get SeProfileSingleProcessPrivilege\n");
return 0;
}

CloseHandle(hToken);

HMODULE ntdll = LoadLibrary(L"ntdll.dll");
if (!ntdll)
{
fprintf(stderr, "\nCan't load ntdll.dll, wrong Windows version?\n");
return 0;
}

typedef DWORD NTSTATUS; // ?
NTSTATUS(WINAPI *NtSetSystemInformation)(INT, PVOID, ULONG) = (NTSTATUS(WINAPI *)(INT, PVOID, ULONG))GetProcAddress(ntdll, "NtSetSystemInformation");
NTSTATUS(WINAPI *NtQuerySystemInformation)(INT, PVOID, ULONG, PULONG) = (NTSTATUS(WINAPI *)(INT, PVOID, ULONG, PULONG))GetProcAddress(ntdll, "NtQuerySystemInformation");
if (!NtSetSystemInformation || !NtQuerySystemInformation)
{
printf_s("\nCan't get function addresses, wrong Windows version?\n");
return 0;
}

SYSTEM_MEMORY_LIST_COMMAND command = MemoryPurgeStandbyList;
NTSTATUS status = NtSetSystemInformation(
SystemMemoryListInformation,
&command,
sizeof(SYSTEM_MEMORY_LIST_COMMAND)
);
if (status == STATUS_PRIVILEGE_NOT_HELD)
{
printf_s("\nInsufficient privileges to execute the memory list command\n");
}
else if (status > 0)
{
printf_s("\nUnable to execute the memory list command %x\n", status);
}
return status;

}


/*
int _tmain(int argc, _TCHAR* argv[])
{
Expand Down
24 changes: 12 additions & 12 deletions curses.h
Expand Up @@ -243,30 +243,30 @@ typedef struct

typedef struct _win /* definition of a window */
{
int _cury; /* current pseudo-cursor */
struct _win *_parent; /* subwin's pointer to parent win */
int _cury; /* current pseudo-cursor */
int _curx;
int _maxy; /* max window coordinates */
int _maxx;
int _begy; /* origin on screen */
int _begx;
int _flags; /* window properties */
chtype _attrs; /* standard attributes and colors */
chtype _bkgd; /* background, normally blank */
bool _clear; /* causes clear at next refresh */
int *_firstch; /* first changed character in line */
int *_lastch; /* last changed character in line */
int _tmarg; /* top of scrolling region */
int _bmarg; /* bottom of scrolling region */
int _delayms; /* milliseconds of delay for getch() */
int _parx, _pary; /* coords relative to parent (0,0) */
chtype _attrs; /* standard attributes and colors */
chtype _bkgd; /* background, normally blank */
chtype **_y; /* pointer to line pointer array */
bool _clear; /* causes clear at next refresh */
bool _leaveit; /* leaves cursor where it is */
bool _scroll; /* allows window scrolling */
bool _nodelay; /* input character wait flag */
bool _immed; /* immediate update flag */
bool _sync; /* synchronise window ancestors */
bool _use_keypad; /* flags keypad key mode active */
chtype **_y; /* pointer to line pointer array */
int *_firstch; /* first changed character in line */
int *_lastch; /* last changed character in line */
int _tmarg; /* top of scrolling region */
int _bmarg; /* bottom of scrolling region */
int _delayms; /* milliseconds of delay for getch() */
int _parx, _pary; /* coords relative to parent (0,0) */
struct _win *_parent; /* subwin's pointer to parent win */
} WINDOW;

/* Avoid using the SCREEN struct directly -- use the corresponding
Expand Down

0 comments on commit 38ea2f0

Please sign in to comment.