aibika 1.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +11 -0
- data/History.txt +214 -0
- data/LICENSE.md +30 -0
- data/Manifest.txt +11 -0
- data/README.adoc +564 -0
- data/Rakefile +30 -0
- data/aibika.gemspec +50 -0
- data/bin/aibika +25 -0
- data/lib/aibika/aibika_builder.rb +191 -0
- data/lib/aibika/cli.rb +181 -0
- data/lib/aibika/host.rb +40 -0
- data/lib/aibika/library_detector.rb +88 -0
- data/lib/aibika/pathname.rb +158 -0
- data/lib/aibika/version.rb +5 -0
- data/lib/aibika.rb +675 -0
- data/samples/activerecord_sample.rb +6 -0
- data/samples/bundler_git/Gemfile +3 -0
- data/samples/bundler_git/bundler_git.rb +5 -0
- data/samples/mech.rb +8 -0
- data/samples/mime-types_sample.rb +4 -0
- data/samples/pg_sample.rb +4 -0
- data/samples/prawn_sample.rb +9 -0
- data/samples/readchar.rb +4 -0
- data/samples/sysproctable.rb +12 -0
- data/samples/tk.rb +13 -0
- data/samples/tkextlib.rb +4 -0
- data/samples/watir_sample.rb +31 -0
- data/samples/win32_api_sample.rb +5 -0
- data/samples/win32ole.rb +4 -0
- data/samples/wxruby_sample.rbw +29 -0
- data/share/aibika/lzma.exe +0 -0
- data/src/Makefile +37 -0
- data/src/edicon.c +146 -0
- data/src/lzma/LzmaDec.c +1007 -0
- data/src/lzma/LzmaDec.h +223 -0
- data/src/lzma/Types.h +208 -0
- data/src/seb.exe +0 -0
- data/src/stub.c +703 -0
- data/src/stub.rc +1 -0
- data/src/vit-ruby.ico +0 -0
- metadata +109 -0
data/samples/readchar.rb
ADDED
data/samples/tk.rb
ADDED
data/samples/tkextlib.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'watir'
|
5
|
+
exit if defined?(Aibika)
|
6
|
+
|
7
|
+
test_site = 'http://www.google.com'
|
8
|
+
|
9
|
+
ie = Watir::IE.new
|
10
|
+
|
11
|
+
puts 'Beginning of test: Google search.'
|
12
|
+
puts " Step 1: go to the test site: #{test_site}"
|
13
|
+
ie.goto test_site
|
14
|
+
|
15
|
+
puts " Step 2: enter 'pickaxe' in the search text field."
|
16
|
+
ie.text_field(:name, 'q').set 'pickaxe' # "q" is the name of the search field
|
17
|
+
|
18
|
+
puts " Step 3: click the 'Google Search' button."
|
19
|
+
ie.button(:name, 'btnG').click # "btnG" is the name of the Search button
|
20
|
+
|
21
|
+
puts ' Expected Result:'
|
22
|
+
puts " A Google page with results should be shown. 'Programming Ruby' should be high on the list."
|
23
|
+
|
24
|
+
puts ' Actual Result:'
|
25
|
+
if ie.text.include? 'Programming Ruby'
|
26
|
+
puts " Test Passed. Found the test string: 'Programming Ruby'. Actual Results match Expected Results."
|
27
|
+
else
|
28
|
+
puts " Test Failed! Could not find: 'Programming Ruby'."
|
29
|
+
end
|
30
|
+
|
31
|
+
ie.close
|
data/samples/win32ole.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'wx'
|
5
|
+
|
6
|
+
# Main window frame with a button.
|
7
|
+
class MyMainWindow < Wx::Frame
|
8
|
+
MY_BUTTON_ID = 1001
|
9
|
+
def initialize
|
10
|
+
super(nil, -1, 'AIBIKA wxWidgets sample application')
|
11
|
+
@button = Wx::Button.new(self, MY_BUTTON_ID, 'AIBIKA Sample')
|
12
|
+
evt_button(MY_BUTTON_ID) { close }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# The sample application.
|
17
|
+
class MyApp < Wx::App
|
18
|
+
def on_init
|
19
|
+
@frame = MyMainWindow.new
|
20
|
+
@frame.show
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Create MyApp
|
25
|
+
app = MyApp.new
|
26
|
+
|
27
|
+
# Run MyApp (unless Aibika is currently defined, and we are compiling
|
28
|
+
# the application).
|
29
|
+
app.main_loop unless defined?(Aibika)
|
Binary file
|
data/src/Makefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
SRCS = lzma/LzmaDec.c
|
2
|
+
OBJS = $(SRCS:.c=.o) stubicon.o
|
3
|
+
CC = gcc
|
4
|
+
BINDIR = $(CURDIR)/../share/aibika
|
5
|
+
|
6
|
+
CFLAGS = -Wall -O2 -DWITH_LZMA -Ilzma -s
|
7
|
+
STUB_CFLAGS = -D_CONSOLE $(CFLAGS)
|
8
|
+
STUBW_CFLAGS = -mwindows $(CFLAGS)
|
9
|
+
# -D_MBCS
|
10
|
+
|
11
|
+
all: stub.exe stubw.exe edicon.exe
|
12
|
+
|
13
|
+
stubicon.o: stub.rc
|
14
|
+
windres -i $< -o $@
|
15
|
+
|
16
|
+
stub.exe: $(OBJS) stub.o
|
17
|
+
$(CC) $(STUB_CFLAGS) $(OBJS) stub.o -o stub
|
18
|
+
|
19
|
+
stubw.exe: $(OBJS) stubw.o
|
20
|
+
$(CC) $(STUBW_CFLAGS) $(OBJS) stubw.o -o stubw
|
21
|
+
|
22
|
+
edicon.exe: edicon.o
|
23
|
+
$(CC) $(CFLAGS) edicon.o -o edicon
|
24
|
+
|
25
|
+
stub.o: stub.c
|
26
|
+
$(CC) $(STUB_CFLAGS) -o $@ -c $<
|
27
|
+
|
28
|
+
stubw.o: stub.c
|
29
|
+
$(CC) $(STUBW_CFLAGS) -o $@ -c $<
|
30
|
+
|
31
|
+
clean:
|
32
|
+
rm -f $(OBJS) stub.exe stubw.exe edicon.exe edicon.o stubw.o stub.o
|
33
|
+
|
34
|
+
install: stub.exe stubw.exe edicon.exe
|
35
|
+
cp -f stub.exe $(BINDIR)/stub.exe
|
36
|
+
cp -f stubw.exe $(BINDIR)/stubw.exe
|
37
|
+
cp -f edicon.exe $(BINDIR)/edicon.exe
|
data/src/edicon.c
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
/**
|
2
|
+
Changes the Icon in a PE executable.
|
3
|
+
*/
|
4
|
+
|
5
|
+
#include <windows.h>
|
6
|
+
#include <stdio.h>
|
7
|
+
|
8
|
+
#pragma pack(push, 2)
|
9
|
+
|
10
|
+
/* Icon file header */
|
11
|
+
typedef struct
|
12
|
+
{
|
13
|
+
WORD Reserved;
|
14
|
+
WORD ResourceType;
|
15
|
+
WORD ImageCount;
|
16
|
+
} IconFileHeader;
|
17
|
+
|
18
|
+
/* Icon File directory entry structure */
|
19
|
+
typedef struct
|
20
|
+
{
|
21
|
+
BYTE Width;
|
22
|
+
BYTE Height;
|
23
|
+
BYTE Colors;
|
24
|
+
BYTE Reserved;
|
25
|
+
WORD Planes;
|
26
|
+
WORD BitsPerPixel;
|
27
|
+
DWORD ImageSize;
|
28
|
+
DWORD ImageOffset;
|
29
|
+
} IconDirectoryEntry;
|
30
|
+
|
31
|
+
/* Group Icon Resource directory entry structure */
|
32
|
+
typedef struct
|
33
|
+
{
|
34
|
+
BYTE Width;
|
35
|
+
BYTE Height;
|
36
|
+
BYTE Colors;
|
37
|
+
BYTE Reserved;
|
38
|
+
WORD Planes;
|
39
|
+
WORD BitsPerPixel;
|
40
|
+
DWORD ImageSize;
|
41
|
+
WORD ResourceID;
|
42
|
+
} IconDirResEntry, *PIconDirResEntry;
|
43
|
+
|
44
|
+
/* Group Icon Structore (RT_GROUP_ICON) */
|
45
|
+
typedef struct
|
46
|
+
{
|
47
|
+
WORD Reserved;
|
48
|
+
WORD ResourceType;
|
49
|
+
WORD ImageCount;
|
50
|
+
IconDirResEntry Enries[0]; /* Number of these is in ImageCount */
|
51
|
+
} GroupIcon;
|
52
|
+
|
53
|
+
#pragma pack(pop)
|
54
|
+
|
55
|
+
BOOL UpdateIcon(LPTSTR ExecutableFileName, LPTSTR IconFileName)
|
56
|
+
{
|
57
|
+
HANDLE h = BeginUpdateResource(ExecutableFileName, FALSE);
|
58
|
+
if (h == INVALID_HANDLE_VALUE)
|
59
|
+
{
|
60
|
+
printf("Failed to BeginUpdateResource\n");
|
61
|
+
return FALSE;
|
62
|
+
}
|
63
|
+
|
64
|
+
/* Read the Icon file */
|
65
|
+
HANDLE hIconFile = CreateFile(IconFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
66
|
+
if (hIconFile == INVALID_HANDLE_VALUE)
|
67
|
+
{
|
68
|
+
fprintf(stderr, "Failed to open icon file.\n");
|
69
|
+
return FALSE;
|
70
|
+
}
|
71
|
+
DWORD Size = GetFileSize(hIconFile, NULL);
|
72
|
+
BYTE* Data = LocalAlloc(LMEM_FIXED, Size);
|
73
|
+
DWORD BytesRead;
|
74
|
+
if (!ReadFile(hIconFile, Data, Size, &BytesRead, NULL))
|
75
|
+
{
|
76
|
+
fprintf(stderr, "Failed to read icon file.\n");
|
77
|
+
return FALSE;
|
78
|
+
}
|
79
|
+
CloseHandle(hIconFile);
|
80
|
+
|
81
|
+
IconFileHeader* header = (IconFileHeader*)Data;
|
82
|
+
IconDirectoryEntry* entries = (IconDirectoryEntry*)(header + 1);
|
83
|
+
|
84
|
+
/* Create the RT_ICON resources */
|
85
|
+
int i;
|
86
|
+
for (i = 0; i < header->ImageCount; ++i)
|
87
|
+
{
|
88
|
+
BOOL b = UpdateResource(h, MAKEINTRESOURCE(RT_ICON), MAKEINTRESOURCE(101 + i), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), Data + entries[i].ImageOffset, entries[i].ImageSize);
|
89
|
+
if (!b)
|
90
|
+
{
|
91
|
+
fprintf(stderr, "failed to UpdateResource %lu\n", GetLastError());
|
92
|
+
return FALSE;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
/* Create the RT_GROUP_ICON structure */
|
97
|
+
DWORD GroupIconSize = sizeof(GroupIcon) + header->ImageCount * sizeof(IconDirectoryEntry);
|
98
|
+
GroupIcon* gi = (GroupIcon*)LocalAlloc(LMEM_FIXED, GroupIconSize);
|
99
|
+
gi->Reserved = 0;
|
100
|
+
gi->ResourceType = header->ResourceType;
|
101
|
+
gi->ImageCount = header->ImageCount;
|
102
|
+
for (i = 0; i < header->ImageCount; ++i)
|
103
|
+
{
|
104
|
+
IconDirResEntry* e = &gi->Enries[i];
|
105
|
+
e->Width = entries[i].Width;
|
106
|
+
e->Height = entries[i].Height;
|
107
|
+
e->Colors = entries[i].Colors;
|
108
|
+
e->Reserved = entries[i].Reserved;
|
109
|
+
e->Planes = entries[i].Planes;
|
110
|
+
e->BitsPerPixel = entries[i].BitsPerPixel;
|
111
|
+
e->ImageSize = entries[i].ImageSize;
|
112
|
+
e->ResourceID = 101 + i;
|
113
|
+
}
|
114
|
+
|
115
|
+
/* Save the RT_GROUP_ICON resource */
|
116
|
+
BOOL b = UpdateResource(h, MAKEINTRESOURCE(RT_GROUP_ICON), MAKEINTRESOURCE(100), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), gi, GroupIconSize);
|
117
|
+
if (!b)
|
118
|
+
{
|
119
|
+
fprintf(stderr, "Failed to create group icon.\n");
|
120
|
+
return FALSE;
|
121
|
+
}
|
122
|
+
|
123
|
+
if (!EndUpdateResource(h, FALSE))
|
124
|
+
{
|
125
|
+
fprintf(stderr, "Failed to EndUpdateResource.\n");
|
126
|
+
return FALSE;
|
127
|
+
}
|
128
|
+
|
129
|
+
return TRUE;
|
130
|
+
}
|
131
|
+
|
132
|
+
int main(int argc, char* argv[])
|
133
|
+
{
|
134
|
+
if (argc == 3)
|
135
|
+
{
|
136
|
+
if (UpdateIcon(argv[1], argv[2]))
|
137
|
+
return 0;
|
138
|
+
else
|
139
|
+
return -1;
|
140
|
+
}
|
141
|
+
else
|
142
|
+
{
|
143
|
+
fprintf(stderr, "Usage: edicon.exe <exefile> <icofile>\n");
|
144
|
+
return -1;
|
145
|
+
}
|
146
|
+
}
|