Programming and Coding
Programming and coding tips, help and solutions...
1,876 topics in this forum
-
C# .NET 1.1 SendMail
by JMC31337- 1 reply
- 13.5k views
Heres how ya send HTML with attachment in .NET 1.1 Believe .NET 1.1 comes pre-installed on all 32 bit machines What this does is creates a rar archive with 123.txt in it, then emails it out Depending upon what your ISP is, you will need to change the SmtpServer variable Multiple recipients need to have a ; in between em .NET Framework 1.1 is no longer supported through Express C# 2002-2003 You'll need to install the .NET Framework 1.1 Redistributable and .NET 1.1 SDK This has to be compiled from commandline with csc /out:c:\smtp.exe Program.cs or if you want no console window csc /target:winexe /out:c:\smtp.exe Program.cs Directory should be %windir%\Microsoft.NET\Framewo…
-
- 0 replies
- 2.5k views
Tricking ildasm Into Dumping a Metadata Delta File u can trick ildasm into dumping the metadata delta file. Just add .obj to the filename and constrain the output: > ildasm TESTME.exe.1.dmeta.obj /text /metadata=raw /metadata=heaps
-
- 0 replies
- 5.1k views
.NET Exceptions (all of them) The surce code for generating the list of .NET exceptions that I posted earlier. Here it is finally. This just outputs an XML structure to the console. You can redirect the output to a file then use an XSLT transform on it (or do whatever else you want with it). using System;using System.Collections.Generic;using System.Text;using System.Reflection;using System.Collections;using System.Text.RegularExpressions;using System.Design;using System.Xml;using System.IO;namespace ExceptionList{ class Program { static void Main(string[] args) { ReflectionSearch(".*exception$"); Console.ReadKey(); } …
-
Writing "portable" code
by deepzero- 6 replies
- 5.3k views
Hey, I was analyzing an interesting piece of malware, where code, data & IAT where all mixed together in one section. IE, text string and dwords with imported addresses where pasted just in the middle of the code: Note how the "call 40100d" calls past the OpenProcess-DWORD, effectively pushing the address to that DOWRD to the stack. So after the "Pop eax", eax contains a pointer to the address of OpenProcess...and can be called via "call dword [eax]". Which is exactly what happens. This is part of the runtime importing, again the calls call past a text string, pushing a pointer to the string to the stack. Later this is used to build the import table. The b…
-
- 1 reply
- 8.4k views
Introduction This book demonstrates the process of creating a language compiler for the CLR. It contains a mixture of generic compiler construction topics and topics specific to compiling for the CLR. How it came to be For many years, I wanted to write a compiler. I read, or tried to read, a lot of books on the subject. Two things about these books consistently turned me off: one, they were, one and all, written using language familiar to mathematics and computer science students, but Greek (many a time, literally) to the rest of us. Two, almost all of them were full of information about sundry alternate means to read source code and understand it, but contained precious …
-
RelocationDirectory/ImportDirectory/ExportDirectory struct
by CodeExplorer- 1 reply
- 5k views
Currently I build and Metadata reader/writer, first I need these strcuts defined in C# RelocationDirectory struct ImportDirectory struct ExportDirectory struct Anybody knows from where I could get them?
-
DebugView filter editor v1.0
by sirp- 1 reply
- 2.7k views
DebugView filter editor v1.0 DebugView is a wonderful tool for viewing real time logging information generated by your applications. You can set filters which will colorize the output according to various rules. But the dialog for setting those filters is awful, especially now when it supports 20 filters. So I developed this little application in Python using the wxPython GUI toolkit to make it easier for me to change the filters. SITE DebugView_Filter_Editor_ 1.0.rar
-
- 5 replies
- 3.4k views
It was an amazing adventure reversing QUAD RegistryCleaner 1.5.144, I would say the reversing level of it is Medium.... but you can easly reverse if you watch Lena's tuts 1~16. I am posting this for educational purpose only, and to expose new stuff [maybe] to other members... hope you'll like it, take it and modify it, do w.e you want to. you can even use the SnD function from it in your own patchers to easly make patchers, no need for stuff like dUP2, i'm just showing how easy it is to create a patcher yourself, source code is in Delphi 2010. unit main;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, png…
-
C++: pointer to byte array
by deepzero- 8 replies
- 14.1k views
Hi, For some reason i cant get a pointer to the first element of a byte array, which is driving me mad. COnsider this: BYTE searchpattern[] = {0x6d, 0x70, 0x6f, 0x72, 0x74}; cout << "deref: " << &searchpattern[0]; Isnt this supposed to dereference the first element of the array? Instead it prints the whole array. or />http://msdn.microsoft.com/en-us/library/hbswzcs5%28VS.80%29.aspx BYTE* pbArr = &searchpattern[0]; cout << "asdf: " << pbArr; same thing... or BYTE* pbArr = &searchpattern[0]; cout << &pbArr; This prints a pointer to 1 dword before the actual array... any help would be appreciated, chances are …
-
- 0 replies
- 5.6k views
DynamicProxy ... ... methodIlGenerator.Emit(OpCodes.Ldc_I4_2); methodIlGenerator.Emit(OpCodes.Ldarg_1); methodIlGenerator.Emit(OpCodes.Ceq); methodIlGenerator.Emit(OpCodes.Ldc_I4_0); methodIlGenerator.Emit(OpCodes.Ceq); methodIlGenerator.Emit(OpCodes.Stloc_3); methodIlGenerator.Emit(OpCodes.Ldloc_3); ... ... ...if that is too much trouble fumbling with the low-level opcode can also spread an alternative to the comfortable castleproject DynamicProxy and use the local IL-generation mechanisms (easy type / easy method etc.) so that's really "Easy" Castle DynamicProxy is a library for generating lightweight .NET proxies on the fly at runtime. Proxy objects allo…
-
[DELPHI]Return offset by AOB
by 0xFF- 1 reply
- 4.9k views
This is a little silly code that will return the offset by searching it via a static array of size 7 byte(s). Made it for the patcher of QUAD RegistryCleaner 1.5.144, more to come, this code is first RLS, and could be optimized and tweaked using threads and better searching patterns, future updates to come. Usage: ShowMessageFmt( '%x', [RetOffset(lol)]); lol: array [0..6] of byte = ($FF, $FF, $FF, $FF, $FF, $FF, $FF); <-- change FF's to your needs. you can modify it and make it search bigger buffers, but be ware of getting "Eof", calculate file size and div by the amount of searches you're going to perfom. type TStaticArray = ARray [0..6] Of Byte;function RetOffset(co…
-
(c++) int 2 hex (simple way?)
by deepzero- 8 replies
- 7.4k views
Hi, i have a decimal number in an int variable, which i want to convert to hex and save in a DWORD, ie: int a = 4660; -> == DWORD b = 1234; I was not able to find a simple way to do this conversion. It works via strtol or sprintf, but there has to be an easier way? After all, the int variable is stored in hex in memory... deep
-
- 1 follower
- 5 replies
- 9.7k views
The Undocumented Microsoft Functions About ATOM_BASIC_INFORMATION ATOM_INFORMATION_CLASS ATOM_TABLE_INFORMATION DbgPrint DBG_STATE EVENT_BASIC_INFORMATION EVENT_INFORMATION_CLASS EVENT_TYPE FILE_BASIC_INFORMATION FILE_BOTH_DIR_INFORMATION FILE_DIRECTORY_INFORMATION FILE_FS_ATTRIBUTE_INFORMATION FILE_FS_CONTROL_INFORMATION FILE_FS_DEVICE_INFORMATION FILE_FS_LABEL_INFORMATION FILE_FS_SIZE_INFORMATION FILE_FS_VOLUME_INFORMATION FILE_FULL_DIR_INFORMATION FILE_FULL_EA_INFORMATION FILE_GET_EA_INFORMATION FILE_INFORMATION_CLASS FILE_INTERNAL_INFORMATION FILE_LINK_INFORMATION FILE_NAMES_INFORMATION FILE_NAME_INFORMATION FILE_NETWORK_OPEN_INFORMATION FILE_NOTIFY_INFORMATION FILE_R…
-
- 0 replies
- 4.3k views
ILViewer v2.0 This is an Add-in to Visual Studio Description his helps us to view the MSIL (Microsoft Intermediate Language) generated for C# or VB.Net code we write. Expected Users Those who are interested in studying - How compiler is handling your code? How new language features are implemented? Example What is the MSIL equivalent for ‘property’ in C# or VB.Net? When you write a property in C#, compiler is generating some methods corresponding to it. Eventhough .property is there, the get_property and set_property methods are the working methods blog project ILViewer(2).rar ILVIewer-74794.zip
-
- 0 replies
- 3.8k views
Write Custom Static Code Analysis Rules Using FxCop Microsoft's FxCop was released in 2002 as a static code analysis tool. After this initial released version, Microsoft has added new features and updated this tool very frequently. FxCop has now become the most amazing tool in Microsoft Visual Studio environment. It's now integrated with Microsoft Visual Studio 2010 (premium and ultimate editions only) and developer's community may better know this as 'Code Analysis' or 'Code Review' tool. FxCop perform static code analysis of your application source code without executing the program. Microsoft has divided almost 200 + code analysis rules in different groups or categori…
-
(C++) Send Email
by deepzero- 8 replies
- 9.7k views
Hi, so, i``m trying to send an email from one gmail acc. to another using winosck: Code looks good, google is "at my service", but the email never arrives. #include "stdafx.h" #include <winsock2.h> #include <string> #include <stdlib.h> #include <iostream> using namespace std;#pragma comment(lib, "iphlpapi.lib") #pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "urlmon.lib") #pragma comment(lib, "shell32.lib") int main() { int iProtocolPort = 0; char szBuffer[4096] = ""; SOCKET hServer; LPHOSTENT lpHostEntry; LPSERVENT lpServEntry; SOCKADDR_IN SockAddr; WSADATA WSAData; DWORD WSAResult; WSAResult = WSAStartup(MAKEWOR…
-
Visual Studio backup macro
by sirp- 0 replies
- 6.9k views
Visual Studio backup macro Macro to backup the contents of a solution with a simple click Introduction Have you ever screwed up the code of your project and needed to revert to a past version? Unfortunatelly, Visual Studio doesn't has a backup option. If you need to do so, you have to manually copy your solution folder to another folder or media. Tired of doing that, I decided to make a backup macro: my goal was to add a context menu option to Solution Explorer, to automatize the process of copying its files to the destination location. Background As described above, this adds an item to the solution context menu(named 'Make backup'). When this option is selected, it cle…
-
- 0 replies
- 3.1k views
Why Breakpoint does not hit in Visual Studio? Sometimes while you try to debug a problem in Visual Studio, breakpoints might not hit, and that's annoying. I've prepared a check list that you can follow to make the breakpoints hit when you encounter such situation: 1. Make sure that the Solution/Project is in Debug Mode and not in Release mode. 2. Set a break point at the first line of Page_Load() method within the target page (If you are working with an Asp.net application) and see if that break point hits. If yes, proceed from that break point one by one line by pressing F10 or F11(Where necessary) to make sure that, your all conditions are correctly met before execu…
-
TinyOS in C#
by sirp- 0 replies
- 8.7k views
TinyOS in C# About four years ago (in the middle of the last fifteen years of writing software for money) I graduated from college. I took a round-about way through school at OIT - my four-year degree took eleven years (I actually had to make deals with four different deans to allow me to keep my credits from expiring) but it turned out OK. Some where in the middle of going to school at night we were asked in an Operating Systems class to write a "Virtual CPU and OS." More of an interpreter, we were given a description of the OS, some op-codes and an ASM-like machine language. We were to write the OS, and feed test programs into the system. It was a fun exercise and a goo…
-
- 0 replies
- 2.8k views
ProfilerCallback.cpp // This is the function that will invoke the managed code through COM interop on another thread// this function creates the CCW object// [in] this pointer DWORD WINAPI CreateManagedStub(LPVOID lpParam) { _ManagedStub * pIManagedStub = NULL; HRESULT hr = CoCreateInstance(CLSID_ManagedStub, NULL, CLSCTX_INPROC_SERVER, IID__ManagedStub, (void **)&pIManagedStub); if (FAILED(hr)) { printf("Fail to CoCreateInstance on ManagedStub class 0x%x\n", hr); return 1; } if (pIManagedStub == NULL) { printf("pIManagedStub is null 0x%x\n", hr); return 1; } // we have the managed instance now. (…
-
h4sh3m Generic Patcher Generator
by h4sh3m- 11 replies
- 6.4k views
I coded this Patcher Generator in Delphi. if you found any bug Please send me. Download N-Joy My Friends.
-
Unpacking yoda 1.0-1.3 Exe
by Sevy- 1 follower
- 6 replies
- 8.1k views
Hi all, New here, but noticed some people here know their stuff(well close to all of them). I was hoping to find some help here. I am trying to unpack a exe which is crypted with yoda 1.3. After some searching i found CPS_UnYoda_v1.0b This did something, but not extract it. Though PEid says its yoda 1.x now instead of 1.3 But unpacking it has not worked yet, i also found Quick_Unpack_2.2.Tool But this was in russian language or something. So i have no idea if this can do it, or what error it actually gives when i try. Thanks Any helps is much appreciated.
-
C to Delphi
by iLuvCoding92- 2 replies
- 9.9k views
I am having problems converting this coding form C to Delphi. />http://forum.tuts4you.com/index.php?showtopic=16209&view=findpost&p=81108 char* szMemDump = (char*)malloc(mbi.RegionSize+1);malloc is ok. But I don't what's with all the "char*". if( memcmp( (void*)(szMemDump+x), (void*)szBytes, strlen( szBytes ) ) == 0 )I just cannot sum both szMemDump and x together?
-
Developing a CIL Parser
by sirp- 0 replies
- 3.7k views
The analysis of .NET libraries in [1] suggests the development of a tool for automatic contract extraction from .NET classes. The article observes that preconditions tend to be hidden under explicit exception cases. A tool leveraging this observation has been developed as part of this diploma thesis and is documented in this report. Although the chosen approach is limited to elementary cases, the application of the tool to classes ArrayList, Stack and Queue of the .NET framework [16] reveals that, in these classes, half or more of all explicit exception cases can be addressed and the corresponding preconditions are extracted by the current implementation. The report inclu…
-
(c++) simpe output
by deepzero- 4 replies
- 11k views
hi, this program is supposed to output the pids & names of all running processes: PROCESSENTRY32 pe32; HANDLE procsnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); pe32.dwSize = sizeof(PROCESSENTRY32); Process32First(procsnap, &pe32); while(Process32Next(procsnap, &pe32)) { printf( "PID: %d [%s]\n", pe32.th32ProcessID, pe32.szExeFile); } However, only the first char of the process name is printed. The PROCESSENTRY32 structure can be found here: />http://msdn.microsoft.com/en-us/library/ms684839%28v=VS.85%29.aspx