Asp to DLL
Dieses Script konvertiert normalen VBScript Code, sodaß man ihn in eine DLL Datei kompilieren kann.
Sehr praktisch, wenn man seinen Programm-Code schützen will.
<%@LANGUAGE="VBScript" %>
<%
Response.Buffer = True
Response.Expires = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; Charset=windows-1254">
<TITLE>Visual Basic DLL Project Builder</TITLE>
<META HTTP-EQUIV="Content-Language" CONTENT="EN">
<META NAME="Author" CONTENT="Cenk Yurtseven">
<META HTTP-EQUIV="Expires" CONTENT="0">
<STYLE TYPE="text/css">
BODY, TD, FORM, INPUT {
font-family : Verdana, Tahoma, Arial;
font-size : 8pt;
}
</STYLE>
</HEAD>
<BODY>
<BR>
<%
Const ForWriting = 2
filesName = Request.Form("filesName")
projectName = Request.Form("projectName")
projectClass = Request.Form("projectName") & "Class"
companyName = Request.Form("companyName")
copyright = Request.Form("copyright")
projectDesc = Request.Form("projectDesc")
versionMajor = Request.Form("versionMajor")
versionMinor = Request.Form("versionMinor")
versionRevision = Request.Form("versionRevision")
If Len(filesName) <> 0 And Len(projectName) <> 0 And Len(companyName) <> 0 And Len(copyright) <> 0 And Len(projectDesc) <> 0 Then
strSearchText = "" & Chr(60) & Chr(37) & vbcrlf & ", Application(, Application., Response(, Response., Request., Request(, Session(, Session., Server., application(, application., response(, response., request., request(, session(, session., server., , " & vbcrlf & Chr(37) & Chr(62) & ""
strReplaceText = ", ObjApplication(, ObjApplication., ObjResponse(, ObjResponse., ObjRequest., ObjRequest(, ObjSession(, ObjSession., ObjServer., ObjApplication(, ObjApplication., ObjResponse(, ObjResponse., ObjRequest., ObjRequest(, ObjSession(, ObjSession., ObjServer., , "
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Left(Server.MapPath("."), InStr(Server.MapPath("."), ":") + 1) & "WINDOWS") Then
WinDir = Left(Server.MapPath("."), InStr(Server.MapPath("."), ":") + 1) & "WINDOWS"
Else
WinDir = Left(Server.MapPath("."), InStr(Server.MapPath("."), ":") + 1) & "WINNT"
End If
WinDir = UCase(WinDir)
Set objACT = objFSO.OpenTextFile(Server.MapPath(filesName))
strFileContents = objACT.readall
objACT.Close
Set objFSO = Nothing
splitSearchText = Split(strSearchText, ",")
splitReplaceText = Split(strReplaceText, ",")
For i = 0 To UBound(splitSearchText)
SearchText = splitSearchText(i)
ReplaceText = splitReplaceText(i)
strFileContents = Replace(strFileContents, SearchText, ReplaceText)
x = x + 1
Next
headerContents = headerContents & "VERSION 1.0 CLASS" & vbcrlf
headerContents = headerContents & "BEGIN" & vbcrlf
headerContents = headerContents & " MultiUse = -1" & vbcrlf
headerContents = headerContents & " Persistable = 0" & vbcrlf
headerContents = headerContents & " DataBindingBehavior = 0" & vbcrlf
headerContents = headerContents & " DataSourceBehavior = 0" & vbcrlf
headerContents = headerContents & " MTSTransactionMode = 0" & vbcrlf
headerContents = headerContents & "END" & vbcrlf
headerContents = headerContents & "Attribute VB_Name = """ & projectClass & """" & vbcrlf
headerContents = headerContents & "Attribute VB_GlobalNameSpace = False" & vbcrlf
headerContents = headerContents & "Attribute VB_Creatable = True" & vbcrlf
headerContents = headerContents & "Attribute VB_PredeclaredId = False" & vbcrlf
headerContents = headerContents & "Attribute VB_Exposed = True" & vbcrlf
headerContents = headerContents & "Option Explicit" & vbcrlf
headerContents = headerContents & "Dim ObjApplication As Application" & vbcrlf
headerContents = headerContents & "Dim ObjResponse As Response" & vbcrlf
headerContents = headerContents & "Dim ObjRequest As Request" & vbcrlf
headerContents = headerContents & "Dim ObjSession As Session" & vbcrlf
headerContents = headerContents & "Dim ObjServer As Server" & vbcrlf
strFileContents = headerContents & strFileContents & vbcrlf
strFileContents = strFileContents & "Public Sub OnStartPage(SQL_Control As ScriptingContext)" & vbcrlf
strFileContents = strFileContents & "Set ObjApplication = SQL_Control.Application" & vbcrlf
strFileContents = strFileContents & "Set ObjRequest = SQL_Control.Request" & vbcrlf
strFileContents = strFileContents & "Set ObjResponse = SQL_Control.Response" & vbcrlf
strFileContents = strFileContents & "Set ObjSession = SQL_Control.Session" & vbcrlf
strFileContents = strFileContents & "Set ObjServer = SQL_Control.Server" & vbcrlf
strFileContents = strFileContents & "End Sub" & vbcrlf
strFileContents = strFileContents & "Public Sub OnEndPage()" & vbcrlf
strFileContents = strFileContents & "Set ObjApplication = Nothing" & vbcrlf
strFileContents = strFileContents & "Set ObjRequest = Nothing" & vbcrlf
strFileContents = strFileContents & "Set ObjResponse = Nothing" & vbcrlf
strFileContents = strFileContents & "Set ObjSession = Nothing" & vbcrlf
strFileContents = strFileContents & "Set ObjServer = Nothing" & vbcrlf
strFileContents = strFileContents & "End Sub" & vbcrlf
For i = 0 To 5
strFileContents = Replace(strFileContents, vbcrlf & vbcrlf, vbcrlf)
Next
strProjContents = strProjContents & "Type=OleDll" & vbcrlf
strProjContents = strProjContents & "Reference=*G{00020430-0000-0000-C000-000000000046}#2.0#0#" & WinDir & "System32stdole2.tlb#OLE Automation" & vbcrlf
strProjContents = strProjContents & "Reference=*G{D97A6DA0-A85C-11CF-83AE-00A0C90C2BD8}#3.0#0#" & WinDir & "System32inetsrvasp.dll#Microsoft Active Server Pages Object Library" & vbcrlf
strProjContents = strProjContents & "Class=" & projectClass & "; " & projectClass & ".cls" & vbcrlf
strProjContents = strProjContents & "Startup=""(None)""" & vbcrlf
strProjContents = strProjContents & "HelpFile=""""" & vbcrlf
strProjContents = strProjContents & "Title=""" & projectName & """" & vbcrlf
strProjContents = strProjContents & "ExeName32=""" & projectName & ".dll""" & vbcrlf
strProjContents = strProjContents & "Command32=""""" & vbcrlf
strProjContents = strProjContents & "Name=""" & projectName & """" & vbcrlf
strProjContents = strProjContents & "HelpContextID=""0""" & vbcrlf
strProjContents = strProjContents & "CompatibleMode=""1""" & vbcrlf
strProjContents = strProjContents & "CompatibleEXE32=""" & projectName & ".dll""" & vbcrlf
strProjContents = strProjContents & "MajorVer=" & versionMajor & vbcrlf
strProjContents = strProjContents & "MinorVer=" & versionMinor & vbcrlf
strProjContents = strProjContents & "RevisionVer=" & versionRevision & vbcrlf
strProjContents = strProjContents & "AutoIncrementVer=0" & vbcrlf
strProjContents = strProjContents & "ServerSupportFiles=0" & vbcrlf
strProjContents = strProjContents & "VersionComments=""" & projectDesc & """" & vbcrlf
strProjContents = strProjContents & "VersionCompanyName=""" & companyName & """" & vbcrlf
strProjContents = strProjContents & "VersionFileDescription=""" & projectDesc & """" & vbcrlf
strProjContents = strProjContents & "VersionLegalCopyright=""" & copyright & """" & vbcrlf
strProjContents = strProjContents & "VersionProductName=""" & projectName & """" & vbcrlf
strProjContents = strProjContents & "CompilationType=0" & vbcrlf
strProjContents = strProjContents & "OptimizationType=0" & vbcrlf
strProjContents = strProjContents & "FavorPentiumPro(tm)=0" & vbcrlf
strProjContents = strProjContents & "CodeViewDebugInfo=0" & vbcrlf
strProjContents = strProjContents & "NoAliasing=0" & vbcrlf
strProjContents = strProjContents & "BoundsCheck=0" & vbcrlf
strProjContents = strProjContents & "OverflowCheck=0" & vbcrlf
strProjContents = strProjContents & "FlPointCheck=0" & vbcrlf
strProjContents = strProjContents & "FDIVCheck=0" & vbcrlf
strProjContents = strProjContents & "UnroundedFP=0" & vbcrlf
strProjContents = strProjContents & "StartMode=1" & vbcrlf
strProjContents = strProjContents & "Unattended=0" & vbcrlf
strProjContents = strProjContents & "Retained=0" & vbcrlf
strProjContents = strProjContents & "ThreadPerObject=0" & vbcrlf
strProjContents = strProjContents & "MaxNumberOfThreads=1" & vbcrlf
strProjContents = strProjContents & "ThreadingModel=1" & vbcrlf
strProjContents = strProjContents & vbcrlf
strProjContents = strProjContents & "[MS Transaction Server]" & vbcrlf
strProjContents = strProjContents & "AutoRefresh=1" & vbcrlf
vbwLine = projectClass & " = 0, 0, 0, 0, C"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFilWrite = objFSO.OpenTextFile(Server.MapPath(projectName & "Class.cls"), ForWriting, True)
objFilWrite.Write strFileContents
objFilWrite.Close
Set objFilWrite = objFSO.OpenTextFile(Server.MapPath(projectName & ".vbp"), ForWriting, True)
objFilWrite.Write strProjContents
objFilWrite.Close
Set objFilWrite = objFSO.OpenTextFile(Server.MapPath(projectName & ".vbw"), ForWriting, True)
objFilWrite.Write vbwLine
objFilWrite.Close
''Set objFilWrite = objFSO.OpenTextFile(Server.MapPath(projectName & ".dll"), ForWriting, True)
''objFilWrite.Write projectName & ".dll"
''objFilWrite.Close
Set objFSO = Nothing
Response.Write "<DIV ALIGN=""center""><B>" & x & "</B> variables names Replaced successfully!<BR><BR><B>The Project Files have been build successfully.</B><BR><BR>Open the file: <B>" & projectName & ".vbp</B> in Microsoft Visual Basic 6.0 and click on: <B>File >> Make " & projectName & ".dll</B><BR><BR>Note: you will get an error message when you open the project file, since the DLL does not exist yet.<BR>Click on OK and continue.</DIV>"
End If
%>
<BR>
<BR>
<FORM ACTION="AspToDLL.asp" METHOD="post">
<TABLE ALIGN="center" WIDTH="85%" CELLSPACING="0" CELLPADDING="2" BORDER="0">
<TR>
<TD>File To Convert:</TD>
<TD>
<INPUT TYPE="text" NAME="filesName" SIZE="35"></TD></TR>
<TR>
<TD>Project Name:</TD>
<TD>
<INPUT TYPE="text" NAME="projectName" SIZE="35"></TD></TR>
<TR>
<TD>Company Name:</TD>
<TD>
<INPUT TYPE="text" NAME="companyName" SIZE="35"></TD></TR>
<TR>
<TD>Copyright:</TD>
<TD>
<INPUT TYPE="text" NAME="copyright" SIZE="35"></TD></TR>
<TR>
<TD>Project Description:</TD>
<TD>
<INPUT TYPE="text" NAME="projectDesc" SIZE="60"></TD></TR>
<TR>
<TD>Version:</TD>
<TD>
Major: <INPUT TYPE="text" NAME="versionMajor" SIZE="1" VALUE="1">
Minor: <INPUT TYPE="text" NAME="versionMinor" SIZE="1" VALUE="0">
Revision: <INPUT TYPE="text" NAME="versionRevision" SIZE="1" VALUE="0"></TD></TR>
<TR>
<TD> </TD>
<TD>
<INPUT TYPE="submit" VALUE="Build Project"></FORM></TD></TR></TABLE></BODY></HTML>